Query: Find names of sailors who have reserved all boats
This can be represented in relation algebra as:
1. πsname ( ((σsid,bid Reserves) / (σbid Boats)) ⋈ Sailors)
As per Relational algebra, Division can also be represented using basic algebra operator as follows:
A/B= πx(A) - πx((πx(A) * B) - A )
Thus if I convert statement 1 as per Statement 2 then
Reserves/Boats= πsid(Reserves) - πsid(( πbid(Reserves) * Boats) - Reserves )
How can i represent Statement 3 in terms of SQL in the same way as it is in Relation Algebra (i.e without using any operator other than minus/Except(-) and Cross join(*)).
I am trying to achieve it without the use of NOT EXISTS and EXISTS condition.
Schema of tables is as follows:
Sailors(sid: integer, sname: string, rating: integer, age: real)
Boats(bid: integer, bname: string, color: string)
Reserves(sid: integer, bid: integer, day: date)