next up previous
Next: Test for the Absence Up: Nested Subqueries Previous: Set Comparison

Test for Empty Relations

  1. The exists construct returns true if the argument subquery is nonempty.
  2. Find all customers who have a loan and an account at the bank.

     select cname

    from borrower

    where exists (select *

    from depositor

    where depositor.cname = borrower.cname)

Osmar Zaiane
Fri May 22 19:39:12 PDT 1998