Upload
cornelius-sutton
View
214
Download
0
Embed Size (px)
Citation preview
Tutorial 6 SQL
Muhammad [email protected]
SQL - Background
SQL, stands for Structured Query Language, is the most influential commercially marketed query language.
IBM developed the original version of SQL at its San Jose Research Laboratory and implement it (called as Sequel) as part of the System R project in the early 1970s. Now SQL is the standard relational-database language.
The SQL standard is controlled by American National Standards Institute (ANSI) and the International Organization for Standardization (ISO).
SQL - Introduction
The SQL language has several parts (3): DDL, Data-definition language, is used to
define relation schemas, deleting relations, and modifying relation schemas;
DML, Interactive data-manipulation language, includes commands to query tuples from, Insert tuples into, delete tuples from and modify tuples in the database;
And other things, such as view definition, transaction control and etc. DCL (data control language)
SQL – Basic commands
Note: simple but informal syntax! Create a table:
CREATE TABLE <Table_Name> (Attribute_Definitions)
Delete a table:DROP TABLE <Table_Name>
Query:SELECT [DISTINCT] Select_Expression,...FROM Table_References[WHERE Where_Definition]
SQL – Basic commands
Insert:INSERT INTO <Table_Name> [(ColmnList)] VALUES(DataList)
Delete:DELETE FROM <Table_Name> [WHERE Where_Definition]
Update:UPDATE <Table_Name> SET Column_Name1=Expression1, [Column_Name2=Expression2, ...] [WHERE Where_Definition]
SQL - Resources
Reference - Introduction to Structured Query Language:
http://www.cs.auckland.ac.nz/references/sql/sqlTutorial.pdf
Exercise Time!