All mock tests are FREE till 31 December — register to save your progress
Unit 4 · Database Management Systems Paper 2 CS · September 2022

Directions (Q31–35): Sailors S(sid, sname, rating, age): (22, Dustin, 7, 45), (29, Brutus, 1, 33), (31, Lubber, 8, 55.5), (32, Andy, 8, 25.5), (58, Rusty, 10, 35), (64, Horatio, 7, 35), (71, Zorba, 10, 16), (74, Horatio, 9, 35), (85, Art, 3, 25.5), (95, Bob, 3, 63.5). Reserves R(sid, bid, day): (22, 101), (22, 102), (22, 103), (22, 104), (31, 102), (31, 103), (31, 104), (64, 101), (64, 102), (74, 103). Boats B(bid, bname, color): (101, Interlake, blue), (102, Interlake, red), (103, Clipper, green), (104, Marine, red).

Which relational algebra query computes the names of sailors who have reserved all boats?

Pick an option to check yourself, or open the answer below.

Show answer & explanation

Correct answer: B. ρ(Tempsids, π_sid,bid Reserves / π_bid Boats); π_sname(Tempsids ⋈ Sailors)

Explanation

Division needs the (sid, bid) pairs from Reserves divided by all bids: π_sid,bid(Reserves) ÷ π_bid(Boats) gives sids paired with every boat. Join with Sailors for the names.

More Database Management Systems questions