EXISTS is used to check whether the result of a Correlated Nested Query (SQL) is empty or not.
SELECT name
FROM EMPLOYEE E
WHERE EXISTS (
SELECT *
FROM DEPENDENT
WHERE E.ssn=essn
AND E.name=dependent_name
)Similarly, you can use NOT EXISTS to check for the reverse condition.