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

Write and run the following queries. Do not show duplicates (50 points) 1. Print

ID: 3914740 • Letter: W

Question

Write and run the following queries. Do not show duplicates (50 points) 1. Print the names of sailors who have reserved at least two boats 2. Print the names of sailors whose rating is within (inclusive) 5 and 8 and have reserved more than two boats 3. Find the average age of sailors who have a rating greater than 7 and have reserved a boat named Clipper or Interlake 4. Find the age of the oldest sailor for each rating level that has reserved a red boat 5. Find the sailors whose rating is worse than some sailor named Andy

Explanation / Answer

Query 1:

SELECT sname

FROM Sailors s, Reserves r1, Reserves r2

WHERE s.sid=r1.sid AND s.sid=r2.sid AND r1.bid<>r2.bid;

Query 3:

SELECT AVG(age)

FROM Boat b, Reserves r,Sailors s

WHERE s.ratig>7 and sid in(

SELECT sid

FROM Reserve r, Boat b

WHERE r.bid=b.bid AND bname="Clipper or bname = "Interlake")

Query 5:

SELECT s1.sid

FROM Sailor s1, Sailor s2

WHERE s1.rating>s2.rating AND s2.sname='Andy';

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