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 relational algebra query computes the sids of sailors with age over 20 who have not reserved a red boat?

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

Show answer & explanation

Correct answer: A. πsid(σage>20 Sailors) − πsid((σcolor='red' Boats) ⋈ Reserves ⋈ Sailors)

Explanation

Take all sailors older than 20 and subtract those who reserved some red boat. B selects an impossible condition, C uses age < 20, and ∧ is not a relational operator.

More Database Management Systems questions