You are on page 1of 1

Practice Questions on Basic SQL

These questions will be discussed in your next tutorial by your TA. They are not for homework.

Question
Consider the Sailors-Boats-Reserves DB described in the text.
sailors(sid, sname, rating, age)
boats(bid, bname, color)
reserved(sid, bid, date)
Write each of the following queries in SQL.
1. Find name and age of every sailor rated 7 or higher.
2. Find the sid and rating of sailors who had reserved the boat with bid=b123 on February 8,
2016.
3. Find the colors of boats reserved by Albert.
4. Find the ids of all sailors who either have a rating of at least 8 or reserved boat b103.
5. Find the name and rating of sailors who have reserved at least two boats.
6. Find the sailor ids of sailors whose rating is better than some sailor called Bob.

You might also like