Uploaded by Nguyen Tuan Hung (K17 HL)

HE176730-Nguyễn Tuấn Hưng

advertisement
1: Find the names of sailors who have reserved boat 103:
σ(bid=103)(Reserves ⨝ Sailors)
2: Find the names of sailors who have reserved a red boat:
π(sname)(σ(color='Red')(Boats ⨝ Reserves ⨝ Sailors))
3: Find the colors of boats reserved by Lubber:
π(color)(σ(sname='Lubber')(Sailors ⨝ Reserves ⨝ Boats))
4: Find the names of sailors who have reserved at least one boat:
π(sname)(Sailors ⨝ Reserves)
5: Find the names of sailors who have reserved a red or a green boat:
π(sname)(σ(color='Red' ∨ color='Green')(Boats ⨝ Reserves ⨝ Sailors))
6: Find the names of sailors who have reserved a red and a green boat:
π(sname)(σ(color='Red')(Boats ⨝ Reserves ⨝ Sailors) ⨝ σ(color='Green')(Boats ⨝
Reserves ⨝ Sailors))
7: Find the sids of sailors with age over 20 who have not reserved a red boat:
π(sid)(σ(age > 20 ∧ ¬(color='Red'))(Sailors ⨝ Reserves ⨝ Boats))
8: Find the names of sailors who have reserved all boats:
π(sname)(Sailors - (Sailors ⨝ Reserves ⨝ Boats))
9: Find the names of sailors who have reserved all boats called Interlake:
π(sname)(σ(bname='Interlake')(Boats ⨝ Reserves ⨝ Sailors) - (Boats σ(bname='Interlake')(Boats ⨝ Reserves ⨝ Sailors)))
10: Find the names of sailors who have reserved at least two boats:
π(sname)(γ(sid)(count(bid), σ(bid≠bid')(Reserves ⨝ Reserves as Reserves')(Reserves ⨝
Reserves as Reserves')) ⨝ Sailors)
Download