Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

EXISTS predicate (existence query)

An existence query checks whether a derived table is empty.


EXISTS subquery



subquery

Subquery that returns a derived table.


Result

True if the derived table is not empty.

False if the derived table is empty.


Example

Select the customers that have not placed an order from the CUSTOMERS table:

SELECT company FROM customers  
   WHERE NOT EXISTS (SELECT order_num FROM orders 
                     WHERE orders.cust_num = customers.cust_num)
   company
   Siemens AG
   Plenzer Trading
   Freddys Fishery
   Externa & Co Kg