By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,303 Members | 1,292 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,303 IT Pros & Developers. It's quick & easy.

Database theory question: safe query

P: n/a
Hi all,

Excuse me if this is not the right place to ask this .., but it's the
closest I could find.

I am reading Ramakrishnan and Gehrke "Database Management Systems". In
their errata for the second edition at
http://www.cs.wisc.edu/~dbbook/openA...errata1st.html
it says

'Page 111, Q9: The tuple relational calculus expression for Q9 is
unsafe if "Boats" is empty. A corrected version of the query is the
following expression: { P | there exists S in Sailors (P.sname =
S.sname and for all R in Reserves (S.sid = R.sid and R.bid = B.bid))
}'

I have two questions about this:

1) why is the query (in the book) not safe if Boats is empty ?

2) How does the corrected query answer the task : 'Find the names of
sailors who have reserved all boats'? What if nobody reserved some
boat -- his/her name will still be selected in the corrected query ?!?

I would appreciate very much if somebody could shed some light on
this.

Regards,

Janis
Nov 11 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.