EXISTS with Subselects (Part 1 of 2)
The EXISTS operator tests a subselect for the existance of one or more rows.
The EXISTS operator returns a TRUE value:
> when even one row in a subselect matches the value comparison in the subselect.
The EXISTS operator returns a FALSE value:
> when no rows in a subselect match the value comparison in the subselect.
The NOT EXISTS operator returns a TRUE value:
> when no rows in a subselect match the value comparison in the subselect.
The NOT EXISTS operator returns a FALSE value:
> when even one row in a subselect matches the value comparison in the subselect.
Format: SELECT select_columns
FROM tables
WHERE [NOT] EXISTS (subselect);
> DB2, MySQL, Oracle, Postgre SQL, and SQL Server support EXISTS.