0% found this document useful (0 votes)
98 views

Practice Questions On Basic SQL: Sailors (Sid, Sname, Rating, Age) Boats (Bid, Bname, Color) Reserved (Sid, Bid, Date)

This document provides 6 practice questions on querying a Sailors-Boats-Reserves database that contains sailors, boats, and reservation information. The questions ask the learner to write SQL queries to find: (1) names and ages of sailors rated 7 or higher, (2) sailor IDs and ratings for sailors who reserved a specific boat on a date, (3) colors of boats reserved by a specific sailor, (4) IDs of sailors rated 8+ or who reserved a specific boat, (5) names and ratings of sailors who reserved 2+ boats, and (6) IDs of sailors with a higher rating than a sailor named Bob.

Uploaded by

John Gong
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
98 views

Practice Questions On Basic SQL: Sailors (Sid, Sname, Rating, Age) Boats (Bid, Bname, Color) Reserved (Sid, Bid, Date)

This document provides 6 practice questions on querying a Sailors-Boats-Reserves database that contains sailors, boats, and reservation information. The questions ask the learner to write SQL queries to find: (1) names and ages of sailors rated 7 or higher, (2) sailor IDs and ratings for sailors who reserved a specific boat on a date, (3) colors of boats reserved by a specific sailor, (4) IDs of sailors rated 8+ or who reserved a specific boat, (5) names and ratings of sailors who reserved 2+ boats, and (6) IDs of sailors with a higher rating than a sailor named Bob.

Uploaded by

John Gong
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 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