SQL Intro

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.

Commons RDBMS:

  • Oracle
  • Microsoft SQL server
  • MySQL
  • PostgreSQL
  • 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.

SQL Select:

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:

  • FROM:
    Specify the table from which the data is going to be extracted.
  • WHERE:
    Filter the data by a condition.
  • GROUP BY:
    Group the rows based on the value list on the GROUP BY Clause.
  • HAVING:
    Filter the group based on the condition. Only return records that match the condition.
  • SELECT:
    Select the field that is needed at the moment. (*) Get all the fields inside the table.
  • DISTINCT:
    Remove all duplicated rows from result.
  • ORDER BY:
    Sort the result base on the specification.

References:

http://en.wikipedia.org/wiki/SQL

Bell, Charles A. (2007) Expert Mysql

This entry was posted in Mysql, SQL and tagged , . Bookmark the permalink.

One Response to SQL Intro

  1. Pingback: PHP and MySQL database connection | Jotorres Web Development

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>