Did you know FaceySpacey is the creator of Redux-First Router and Universal?

The Startup Incubator.
Your one stop social media shop
Resource Categories:

Technical
Non-Technical
Refer A Friend
Popular Articles
DEVELOPMENT TOOLS 1 - VERSION CONTROL (Mercurial)
CONTRACTING 2 - TOP 10 EASY SITE CREATOR TOOLS
Subscribe
MySQL 1 - INTRODUCTION TO DATABASES & SQL
Ok so SQL stands for “Standards Query Language.” It’s a language to get data from basically tables that resemble Excel spreadsheets. MySQL is a particular application that will exist on your server (like PHP) based on SQL, i.e. that uses the SQL language to query those tables.
100% of the applications that these tutorials are written for will use MySQL. The Yii Framework, which we love, requires an SQL database such as MySQL. All the “models” in Yii mirror mysql database tables. That said, we’re not going to focus on MySQL in terms of its use in Yii right now. We’re going to focus on SQL by itself, and the main things you do with this language.
Let’s dive into some code:
SELECT lastname,firstname FROM user WHERE id=3
So what could that simple code snippet possibly be doing? It’s selecting a row from the user table where the user id is 3. It’s specifically selecting only the first and last name columns. If we wanted to select all columns we would use the asterisk symbol like this (note: the asterisk in programming often means all):
SELECT * FROM user WHERE id=3
So that would bring other data in the row, such as the user id itself, email address, phone number, etc.
Now let’s insert a row:
INSERT INTO user (firstname, lastname) VALUES (‘James’, ‘Gillmore’)
That clearly is inserting my first and last name into their respective columns. SQL is supposed to read like plain english. I’m not even going to explain each part, as it should be obvious. The goal of this tutorial is just to get you familiar with the main goals of SQL, i.e. to select data, insert data, and update data. Let’s look at updating now:
UPDATE user SET firstname='Jamie', phone='310-849-8939' WHERE lastname='Gillmore'
That’s updating the row with my last name to have my common nick name, and my phone #.
So that should give you a very good idea of what SQL is for. It’s all about accessing your data. In reality, in programming the sort of applications these tutorials are for, databases will be the easiest part. Basically you’ll find yourself building spreadsheet like tables at the beginning of development of applications, and from then on out for the most part you’ll use your framework, i.e. Yii, to query it via PHP code. Of course there will be some times you have to use SQL directly, but by the time you get to that point, you’ll be a master and learning more about SQL will be easy. So if a developer you hire makes a big stink about database work he has to do, he’s basically stupid. And in reality, he’s talking about modeling your product in general, and if you have a good product spec, it should be very obvious how to model your database. A few decisions may need to be made, particularly in terms of preparing for the future, but if you’re new to this startup thing, don’t worry about the future. Make a good spec and get the product coded up. So in short, it will boil down to how good your product spec is, and how well your developer understands it. Give your application a user table, a table for its primary data type, such as an Article, perhaps a Category table, add the necessary columns to each table, and bang out your application. It’s no biggie because you shouldn’t be attempting to code something extremely complex while you’re learning and new at this.
To learn more SQL go w3schools (it’s where I learned most of the SQL syntax, and I still refer to it regularly):
Comments

SMM 3 - FORMULA TO FIND INFLUENCERS