Subqueries used with not exists

not exists is just like exists except that the where clause in which it is used is satisfied when no rows are returned by the subquery.

For example, to find the names of publishers who do not publish business books, the query is:

select pub_name 
from publishers 
where not exists 
   (select * 
    from titles 
    where pub_id = publishers.pub_id 
    and type = "business")
pub_name 
---------------------------------------- 
Binnet & Hardley 

This query finds the titles for which there have been no sales:

select title 
from titles 
where not exists 
   (select title_id 
    from salesdetail 
    where title_id = titles.title_id) 
title 
----------------------------------------- 
The Psychology of Computer Cooking 
Net Etiquette