Advantage of Using EXISTS Operator
- It is a logical operartor.
- EXISTS Operator is widely used to test the existance of matched records in another tables.
SQL Server EXISTS
The EXISTS operator is used when we are dependent on another subquery which can be in the same table or a different table. When the subquery returns any rows the EXISTS operators return true otherwise false. EXISTS Operator simply checks whether the subquery returns any row. It gives true or False based on the existence of rows. In this article, you will get a clear idea about EXISTS Operator in SQL Server.
Syntax:
SELECT * FROM table_name WHERE
column_name EXISTS (subquery)
Explanation: In the above query we fetched all the records if the subquery exists. A SELECT statement that returns rows. The EXISTS
operator is used to check if the subquery returns any rows.
Contact Us