SQL
Structured Query Language is a default language that all database systems understand. It is designed to be easily written and understood trying to mimic the spoken English language.
SELECT - returns a record set – data from a combination of tables
INSERT - inserts values into a table
UPDATE – updates pre-existing data in a table
CREATE – creates a table in the database
DELETE - removes entire row(s) of data from a table
ALTER - alters definition of a pre-existing table
SELECT
SELECT column_name FROM table_name
DISTINCT
SELECT DISTINCT column_name FROM table_name
WHERE
SELECT column_name FROM table_name WHERE condition
AND/OR
SELECT column_name FROM table_name WHERE simple condition AND/OR simple condition
IN
SELECT column_name FROM table_name WHERE column_name IN (‘value1′, ‘value2′, …)
BETWEEN
SELECT column_name FROM table_name WHERE column_name BETWEEN ‘value1′ AND ‘value2′
LIKE
SELECT column_name FROM table_name WHERE column_name LIKE ‘partphrase%’
% = wildcard (meaning characters, same as * in Access)
e.g. cape% will return cape and cape town
ORDER BY (Sorting)
SELECT column_name FROM table_name ORDER BY column_name ASC/DESC
ASC means that the results will be shown in ascending order, and DESC means that the results will be shown in descending order. If neither is specified, the default is ASC.
If a WHERE clause exists, it must appear before the ORDER BY clause as follows:
SELECT column_name FROM table_name WHERE condition ORDER BY column_name ASC/DESC
INSERT INTO
In order to add records to a table we use the INSERT command.
The syntax for inserting data into a table one row at a time is as follows:
INSERT INTO table_name (column1, column2, …)
VALUES (value1, value2, …)
This will add a new record (row) to the end of the table.
DELETE FROM
In order to delete records from a table we use the DELETE command. It is usually used in conjunction with a WHERE clause.
DELETE FROM table_name WHERE condition
UPDATE & SET
In order to chang information that is already in a table, we use the UPDATE command.
UPDATE table_name SET column_1 = new value WHERE condition