EXISTS Predicate
- Last Updated: May 15, 2020
- 1 minute read
- DataDirect Connectors
- JDBC
- IBM Db2 5.1
- MySQL 5.1
- Progress OpenEdge 5.1
- SAP Sybase 5.1
- Documentation
Purpose
Tests the cardinality of a subquery. It is true only if the cardinality of the subquery is greater than 0; otherwise, it is false.
Syntax
EXISTS (subquery)
Example
SELECT empno, ename, deptno FROM emp e WHERE EXISTS
(SELECT deptno FROM dept WHERE e.deptno = dept.deptno)