Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write SQL queries to answer the following questions using a relational data base

ID: 3935482 • Letter: W

Question

Write SQL queries to answer the following questions using a relational data base:

Sailors (sid {key}: integer, sname: string, rating: integer, age: real)

Boats (bid {key}: integer, bname: string, color: string)

Reserves (sid {foreign key}: integer, bid {foreign key}: integer, day {key}: date)

- - - - - - - - - -

A) Find the names of the oldest sailors. (Note: there may be more than one)

B) Find the name of sailors who never reserved any boat.

C) For each month of 2015, list the month and the number of reservations made during the month (rename as reservations). Assume the Year(x) and Month(x) functions are available for a Date type of parameter for x.

Explanation / Answer

SELECT S.sid, S.sname FROM Sailors S where S.sid NOT IN (SELECT DISTINCT R.sid FROM Reserves R);

SELECT distinct Month(day), count(*) FROM Reserves WHERE Year(day)='2015';

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote