Before we continue talking about php and mysql I want to give you a brief introduction to The SQL World.
SQL (Structure Query Language):
SQL was first introduced by IBM developers Donald Chamberlin and Raymond Boyce in the 70s with the name of SEQUEL. This release of SQL was designed to manipulate a database system call System R. The name of SEQUEL was later change to SQL for trademark reason.
What is a RDBMS:
A Relation Database Management System is not more than the software that is used to manipulate the Database.
- Microsoft SQL server
- SQL Lite
SQL language is divided in two groups:
Data Definition Language (DDL):
Allows you to manipulate the structure of the database. Alter, Drop and Create table are in this group.
Data Modeling Language (DML):
The statements that allow you to interact with data inside the tables. For example select, delete and update.
The select is the most commonly used command. This statement retrieves data from the database. Let’s say that you want to get a list of all employees in your company.
SELECT * FROM Employees
SQL language works a little bit different from other language. Queries aren’t executed in the orders that are written. See execution order below:
Specify the table from which the data is going to be extracted.
Filter the data by a condition.
- GROUP BY:
Group the rows based on the value list on the GROUP BY Clause.
Filter the group based on the condition. Only return records that match the condition.
Select the field that is needed at the moment. (*) Get all the fields inside the table.
Remove all duplicated rows from result.
- ORDER BY:
Sort the result base on the specification.
Bell, Charles A. (2007) Expert Mysql