EXISTS Keyword
The EXISTS keyword is used to check the existence of any record in a subquery, returning true if the record exists and false if the record does not exist.
Syntax
SELECT <COLUMNS> FROM <TABLE_NAME> WHERE EXISTS(SUBQUERY);
Example
SELECT * FROM Employee
WHERE EXISTS (SELECT Dept_Name FROM Department WHERE Department.Dept_Id = Employee.Dept_Id And Department.Dept_Id = 2);
Summary
This Exists keyword determines whether a record exists in the sub-query. If the records in the sub-query exist, EXISTS will return True; otherwise, False.