Structured Query Language
sql
SQLWhat is
History
Statement
DDL
DML
Outline
SQLStructured Query Language
Special-purpose programming language for working with sets of facts and the relationships between them.
DML
DDL
SQL
SEQUEL
Donald D. Chamberlin
and Raymond F. Boyce
1970s
IBM
SQLHistoryDevelop by
(Structured English Query Language)
Initial version
DDLData Definition Language
CREATE
ALTER
an object (a table) in the database
modifies the structure of an existing object
TRUNCATEdeletes all data from a table
DROPdelete an object
DMLData Manipulation Language
Adds rows to an existing table
Modifies a set of existing table rows
Removes existing rows from a table
INSERT
UPDATE
DELETE
INSERT
UPDATE
DELETE
?SelectStatement
Data Retrieval
Criteria
DataTables
What tables contain the data
How data from different sources is related
Which fields or calculations will produce the data
Criteria that data must match to be included
Whether and how to sort the results
SelectStatement
SELECT <field> FROM <table> WHERE <criterion>;
Basic
SELECT name, addressFROM studentWHERE stuID=123;
Example