Nested Queries with Correlation
EXISTS is another set comparison operator, like IN.
If UNIQUE is used, and * is replaced by R.bid, finds sailors with at most one reservation for boat #103.
- UNIQUE checks for duplicate tuples; * denotes all attributes. Why do we have to replace * by R.bid?
Subquery must be recomputed for each Sailors tuple.
- Think of subquery as a function call that runs a query!
WHERE R.bid=103 AND S.sid=R.sid)
Find names of sailors who’ve reserved boat #103: