SQL TUTORIALS-
SQL EXISTS Operator
Introduction-
β In a Simple Word The SQL EXISTS operator is used to check whether a subquery returns any rows. It returns TRUE if the subquery returns one or more rows, and FALSE if the subquery returns no rows...
SQL EXISTS operator
It is faster than IN in many cases, especially with large subqueries.
β Syntax Example -
SELECT column1, column2, ...
FROM table_name
WHERE EXISTS (SELECT 1 FROM another_table WHERE condition);
SQL EXISTS operator
Example Of Two Tables 1)-Employee. And 2)-Department
EmpID | Name | DepID |
---|---|---|
101 | ANNI | 1 |
102 | RAJ | 2 |
103 | POOJA | 3 |
104 | SUJAN | 4 |
105 | RUPESH | 5 |
108 | SIMA | 6 |