Professional Documents
Culture Documents
2 Structured Query Language
2 Structured Query Language
(SQL)
Objectives of SQL
Ideally, a database language should allow a user to:
create the database and table structures;
perform basic data management tasks, such as the insertion,
modification, and deletion of data from the tables;
perform both simple and complex queries.
tables.
The optional WHERE clause : selection
Boats
Find the names and ages of all sailors.
Find the names and ages of all sailors.
Example :
Reserves
Sailors
Reserves X Sailors
The answer :
Find the names of sailors who
have reserved a red boat
Find the Sids of sailors who have
reserved a red boat
Find the colors of boats reserved
by Lubber
Find the colors of boats reserved by
Lubber
Find the names of sailors who
have reserved at least one boat
Find the names of sailors who have
reserved at least one boat
UNION, INTERSECT, AND EXCEPT