PostgreSQL SyntaxLesson 39Free preview
PostgreSQL EXISTS
This lesson is part of PostgreSQL · All levels
Summary
EXISTS is a predicate operator that checks whether a subquery returns at least one line. If there is a line, the result is TRUE; if not, FALSE. Varian NOT EXIST is used to find rows that have no relation whatsoever, and this type of subquery often correlates with external queries.
Key points
- EXISTS is valued TRUE when the subquery produces at least one line.
- NOT EXIST is the opposite of looking for the absence of a relationship.
- Subqueries often correlate with external query columns.
- The execution stops once one line is found so efficiently.
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.