Perform a LEFT JOIN and check for NULL in the WHERE clause. That should be quite different.
Main Topics
Browse All TopicsHello,
I got a bunch of questions on mysql, and answered all of them but one. I know asking to solve homework is against this forums rules, so I only ask for a VERY SMALL hint.
And here is the question:
Use the following schema tables:
* City (zip, name, state)
* Customer (cno, title, firstname, name, zip, address)
* Hotel (hno, name, zip, address)
* Room (hno, type, totalrooms, price)
* Reservation (rno, cno, hno, type, arrival, departure)
Question: Which customers have no reservations? (give two alternative to write the SQL sentence).
Writing one was preety easy:
SELECT C.cno
FROM Customer C
WHERE C.cno <> ALL(SELECT R2.cno FROM Reservation R2);
The other option I found is chaning "<> ALL" to "NOT IN", but I think there must be something more different than this one.
I wanted to use EXCEPT or MINUS, but neither of them is implemented in MySQL.
Please give me a small hint.
Thanks!
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Here's the documentation on rewriting subqueries using outer joins:
http://dev.mysql.com/doc/r
Business Accounts
Answer for Membership
by: snoyes_jwPosted on 2005-12-01 at 12:50:00ID: 15399747
LEFT JOIN, IS NULL