Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.
Checks whether a subquery produces any rows of query results
[ NOT ] EXISTS ( subquery )
The EXISTS condition is TRUE if the subquery result contains at least one row, and FALSE if the subquery result does not contain
any rows. The EXISTS condition cannot be UNKNOWN.
You can reverse the logic of the EXISTS condition by using the NOT EXISTS form. In this case, the test returns TRUE if the
subquery produces no rows, and FALSE otherwise.
List the customers who placed orders after July 13, 2001.
SELECT GivenName, Surname
WHERE EXISTS (
WHERE (OrderDate > '2001-07-13') AND
(Customers.ID = SalesOrders.CustomerID))