Lab 6.
Subqueries and Set Operations
CS122, Summer 2008
(27pt) Complete the following queries in SQL. Please put your
queries
in an SQL script file lab6.sql
and upload it to CSNS
at the end of the lab. Note
that file uploading will be disabled
automatically after 11:30am, and late submission will not be accepted.
- Chapter 6, p.161, Exercise 1-5, 7.
- Complete the following queries without using joins:
- List the names of the titles with less than 9 tracks.
- List the names of the sales persons whose supervisors are supervised by no one.
- Find the name of the sales person who is in charge of the
member Jose MacArthur.
- (+3) Find the names of the sales persons who are in charge of the members of the artist group The Kicks.
[NOTES]
- Unlike what the textbook says, all queries can be completed using MySQL 5.0.
- If a question asks you to use EXISTS, you may use NOT EXISTS as well.
- EXISTS is often used in correlated subqueries.