Tutorial 5 - SQL Practice 1
Tutorial 5 - SQL Practice 1
Basic Queries
Feb.16, 2007
Student Version
You can find help page on how to set up the data set at:
http://www.ugrad.cs.ubc.ca/~cs304/2006W2/practice-questions/SQLpractice/
Part1: The following 5 queries will be based on schema1 and the data
Schema1:
Sailors (sid, sname, rating, age);
Boats (bid, bname, colour);
Reserves (sid, bid, day);
2. Find the names of sailors who have reserved at least one boat
4. Find the sailor IDs of all sailors who have reserved red boats but not green boats
5. Find the names of sailors who have reserved at least two boats
Part2: The following 5 queries will be based on schema2 and the data
Schema2:
Student (snum, sname, major, standing, age);
Faculty (fid, fname, deptid);
Class (name, meets_at, room, fid);
Enrolled (snum, cname);
7. Find the name s of the student who has enrolled in course Database Systems.
9. Find all the courses which are NOT using room R128
10. Find all the students who are in any one of the classes that professor James Smith
teaches.