Create an SQL Subquery

This exercise will
allow you to critique a query and re-write the query in a more
readable and efficient fashion. An SQL neophyte has come to you
with the following query, complain that the query takes a long time to
execute.

The query was
intended to display all book titles that have not yet received any
sales, but the logic is quite convoluted and obtuse.

Your tasks for this
exercise are:

Step 1
– Copy the query below into you c:\Burleson directory and execute
against the sample database.

Step 2
– Re-write the query in a more readable and efficient fashion,
ensuring that your query returns the same values as the original
query.

select
initcap(book_title)
from book

where
book_title not in (
select
distinct
book_title
from
book,
sales
where
book.book_key = sales.book_key
and
quantity > 0);

ANSWER

Either of the
following equivalents is acceptable:

select
book_title
from
book
where
book_key not in (select book_key from sales);