3. Elements of SQL Statements : Predicates in SQL : EXISTS Predicate
 
Share this page                  
EXISTS Predicate
The EXISTS predicate takes the following form:
[NOT] EXISTS (subquery)
It evaluates to true if the set returned by the subquery is not empty. For example:
SELECT ename
FROM employee
WHERE EXISTS
       (SELECT *
       FROM dept
        WHERE dno = employee.dept
       AND floor = 3);
It is typical, but not required, for the subquery argument to EXISTS to be of the form SELECT *.