-- ------------------------------------------------------ -- Example: What Customers Do NOT have shipping addresses -- ------------------------------------------------------ select custid from customer where custid not in (select custid from soaddress) -- ------------------------------------------------------- -- Example: What Projects exist in PjProj and not pjprojem -- ------------------------------------------------------- select project from pjproj where project not in (select project from pjprojem) -- Alternatively... select project from pjproj where not (project in (select project from pjprojem)) -- -------------- -- Other Examples -- -------------- SELECT count(*) FROM address WHERE addr_key NOT IN (SELECT addr_key FROM client) OR addr_key NOT IN (SELECT addr_key FROM employee) OR addr_key NOT IN (SELECT addr_key FROM groups) OR addr_key NOT IN (SELECT addr_key FROM patient) OR addr_key NOT IN (SELECT addr_key FROM provider) -- Alternatively... SELECT count(*) FROM address WHERE NOT (addr_key IN (SELECT addr_key FROM client) AND addr_key IN (SELECT addr_key FROM employee) AND addr_key IN (SELECT addr_key FROM groups) AND addr_key IN (SELECT addr_key FROM patient) AND addr_key IN (SELECT addr_key FROM provider)) -- Both of the above are logically the same but you should compare the -- query plans for both and use the most efficient.