Oracle Consulting Oracle Training Development

Remote DBA

Remote DBA Plans  

Remote DBA Service

Remote DBA RAC

   
Remote DBA Oracle Home
Remote DBA Oracle Training
Remote DBA SQL Tuning Consulting
Remote DBA Oracle Tuning Consulting
Remote DBA Data Warehouse Consulting
Remote DBA Oracle Project Management
Remote DBA Oracle Security Assessment
Remote DBA Unix Consulting
Burleson Books
Burleson Articles
Burleson Web Courses
Burleson Qualifications
Oracle Links
Remote DBA Oracle Monitoring
Remote DBA Support Benefits
Remote DBA Plans & Prices
Our Automation Strategy
What We Monitor
Oracle Apps Support
Print Our Brochure
Contact Us (e-mail)
Oracle Job Opportunities
Oracle Consulting Prices





   

 

 

 

Remote DBA services

Remote DBA Support

Remote DBA RAC

Remote DBA Reasons

Remote Oracle Tuning

Remote DBA Links

Oracle DBA Support

Oracle DBA Forum

Oracle Disaster

Oracle Training

Oracle Tuning

Oracle Training

 Remote DBA SQL Server

Remote MSSQL Consulting

Oracle DBA Hosting

Oracle License Negotiation

 

 


 

 

 

        
 
     Oracle: Compare SQL subqueries

 
One of the problems with SQL is that the same query can be expressed in a variety of ways, all with identical results but widely varying execution plans and readability.  In the example below, the following three SQL queries all produce the same output, but they look quite different.  Each of the below queries produces a list of books that have no sales.  Here is the output:
 
BOOK_TITLE                                                                     
----------------------------------------                                       
was george washington gay?                                                     
cooking light                                                                  
never eat boogers                                                              
how to housebreak your horse                                                    
 
 
Your assignment is as follows:
 
  1. Copy these query and run it against the pubs database to verify that the same results are returned.
 
  1. Once the output is confirmed, investigate each for of the subquery with a Google search and a review of Chapter 19.
 
  1. Write a 300 word paper outlining your conclusions about the most efficient way to get the desired output and your recommendations on the most efficient and readable way to code this SQL query.
 
column book_title format a40
 
-- FORM 1
 
select
  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);
 
-- FORM 2
 
select
   book_title
from
   book
where
   book_key not in (select book_key from sales);
 
 
 
-- FORM 3
 
select
   book_title,
   nvl(quantity,0)
from
   book t,
   sales  s
where
   t.book_key = s.book_key(+)
and
   quantity is null
;


 

     

Remote DBA Service
 

Oracle Tuning Book

 

Advance SQL Tuning Book 

BC Oracle support

Oracle books by Rampant

Oracle monitoring software

 

 

 

 

 

 

 

 

 

BC Remote Oracle Support

Remote DBA

Remote DBA Services

Copyright © 1996 -  2013 by Burleson. All rights reserved.

Oracle® is the registered trademark of Oracle Corporation.