SQL(Structured Query Language) Tutorial is an on-going series. This notice will be removed when the series is compleated.

SQL(Structured Query Language) Tutorial - Contents

LIMIT Command
There are situations where you don't need all the results in the database - you just need a few. Say you need the names of the first 5 characters in the database. If you run a SELECT query, you will get the entire table. But if you use the LIMIT option you can limit the number of results. To get the just 5 characters, the command would be...
Database Relations
There will be many cases when the data in one table is related to the data in another table. This connection between two tables is called a relation. When there is such a relation between two tables, these tables will be connected by inserting the primary key of one table into the corresponding row of the other table. The field used in such a way to connect the two tables is known as the foreign key.
Joining Data From Multiple Tables
Often, the data you need will be spread across two(or more tables). In such cases, we have to join these tables together to get the data. The JOIN statement in SQL is created for a situation like that.
Update/Delete Existing Data in a Table
Now that we know how to insert new data, let see how to edit the existing data. You can edit the data in a table using the UPDATE command.
Inserting Data
So far we where looking at how to get data from the database. But to get that data, there must be some data in the tables. Until now, I provided pre-existing data for you to play around with. Now lets see how to insert your own data into the table. Introducing the 'INSERT' command...
SQL Functions
We had a small preview of SQL functions in the last page about grouping. We saw AVG() in action. Here we are going to see the other available functions. Some of the functions may be same across different SQL databases - but many others will be different. Here is a few links to the SQL function documentation for the most popular database servers...
Group Multiple Rows using GROUP BY
Sometimes you have to group together multiple rows in the result and then get an aggregate from the grouped rows - that's the function of GROUP BY.
Sorting the Results using ORDER BY
Often getting the data is not enough - you have to sort the data also. This is made easy by the ORDER BY clause.
WHERE is the new if
All languages I know use 'if' for conditions - except SQL. It uses where for conditional statements.
SELECT Statement
First thing to learn in SQL is the SELECT command. This command is used to get the data from the database. And its used all the time.
Database Terms - and their Meanings
Before learning the language you will have to learn some words and their meanings. Basic stuff, but you cannot continue without them.
SQL(Structured Query Language) Tutorial
SQL, or Structured Query Language, is the language used to access and manipulate data within a database. It is very simple and very powerful.
SQL(Structured Query Language) Tutorial is an on-going series. This notice will be removed when the series is compleated.
Subscribe to Feed