Question: Hello, I'm working on a problem that asks to find the sailor with the highest count of red boats reserved. The SQL tables look like

Hello, I'm working on a problem that asks to find the sailor with the highest count of "red" boats reserved. The SQL tables look like the following: Hello, I'm working on a problem that asks to find the sailor

To get the count for each red boat, I know the following works:

SELECT B.bid, COUNT (*) AS sailorcount FROM Boats B, Reserves R WHERE R.bid = B.bid AND B.color = red GROUP BY B.bid

However, how would I manipulate that to get the name of the sailor who has reserved the largest amount of red boats? Thank you for the assistance!

sid rating sid bid 22 7 22 29 1 22 101 102 103 104 31 8 8 Dustin Brutus Lubber Andy Rusty Horatio Zorba Horatio Art 22 22 31 10 age 45.0 33.0 55.5 25.5 35.0 35.0 16.0 35.0 25.5 63.5 102 103 32 58 64 71 74 85 day 10/10/98 10/10/98 10/8/98 10/7/98 11/10/98 11/6/98 11/12/98 9/5/98 9/8/98 9/8/98 7 31 10 31 104 9 64 64 101 102 3 95 Bob 3 74 103 Figure 4.15 An Instance S3 of Sailors Figure 4.16 An Instance R2 of Reserves bid color 101 bname Interlake Interlake Clipper Marine blue red 102 103 green red 104 Figure 4.17 An Instance B1 of Boats

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!