AI engineering glossary · SQL databases
What is EXISTS?
EXISTS: A predicate that is true when its subquery returns at least one row. It stops at the first match, so it is efficient for checking presence, and it is safe with NULL, unlike NOT IN.
EXISTS: an example
WHERE EXISTS (SELECT 1 FROM orders o WHERE o.customer_id = c.id) keeps customers who have placed an order.
Related terms
More SQL databases terms
- EXPLAIN
- First normal form
- Foreign key
- FULL OUTER JOIN
- Full table scan
- Functional dependency
- Graph database
- GROUP BY
Where you learn it
EXISTS is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.