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): Consider the relational schema of Sailors S, Reserves R and Boats B.

Table 1: Sailors

SidSnameRatingAge
22Dustin745.0
29Brutus133.0
31Lubber855.5
32Andy825.5
58Rusty1035.5
64Horatio735.5
71Zorba1016.0
74Horatio935.0
85Art325.5
95Bob363.5

Table 2: Reserves

SidBidDay
2210110/10/98
2210210/10/98
2210310/8/98
2210410/7/98
3110211/10/98
3110311/6/98
3110411/12/98
641019/5/98
641029/8/98
741039/8/98

Table 3: Boats

BidBnameColor
101Interlakeblue
102Interlakered
103Clippergreen
104Marinered

Which query/queries compute the names of sailors who have reserved boat 103?
Q1: πsname((σbid=103 Boats) ⋈ Sailors)
Q2: πsname(σbid=103(Reserves ⋈ Sailors))
Q3: πsname((σbid=103 Reserves) ⋈ Sailors)

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

Show answer & explanation

Correct answer: B. Both Q2 and Q3

Explanation

Q2 and Q3 select bid = 103 from reservations (before or after the join). Q1 never uses Reserves; Boats ⋈ Sailors has no common attribute, so it is a cross product listing every sailor.

More Database Management Systems questions