||Oracle Concepts by Burleson
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
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
– Copy the query below into you c:\Burleson directory and execute
against the sample database.
– Re-write the query in a more readable and efficient fashion,
ensuring that your query returns the same values as the original
book_title not in (
book.book_key = sales.book_key
quantity > 0);
Either of the
following equivalents is acceptable:
book_key not in (select book_key from sales);
t.book_key = s.book_key(+)
quantity is null
Was George Washington Gay?
Never Eat Boogers
How To Housebreak Your Horse
For more details, see the "Easy
Oracle Series" a set of books especially designed by Oracle
experts to get you started fast with Oracle database technology.
Download your Oracle scripts now:
definitive Oracle Script collection for every Oracle professional DBA