I have these tables:
Sailors
sid sname rating age
--- ------ ------ ---
22 dustin 7 45
31 john 8 55
58 ben 10 35
Boats
bid bname color
--- --------- -----
101 interlake blue
102 interlake red
103 clipper green
104 clipper red
Reserves
sid bid date
--- --- ----------
22 104 8/10/2014
22 103 7/05/2014
58 103 8/11/2014
31 102 8/11/2014
I am trying to find sailors, sname and rating, who have reserved both a red and a green boat, and I need to write that in relational algebra notation.
I tried this:
Text version, for copying/referencing purposes:
R1 := Boats ⋈ Services R2 := σcolor='Red'(R1) R3 := σcolor='Green'(R1) R4 := R2 ∩ R3 R5 := R4 ⋈ Sailors R6 := πsname,rating(R5)
I was told it was wrong, but not given an explanation as to why. Can someone explain to me what the problem is?
This line was marked as wrong:
R4 := R2 ∩ R3
