Nested Queries of SQL

This nested queries is in the SQL SELECT statement inside another SELECT or action query. The SQL first evaluates the inner query. The result of an inner query is returned to the outer query.

Syntax

SELECT EMPLOYEE_NAME FROM EMPLOYEE WHERE DEPT_code=select

DEPT_code FROM EMPLOYEE WHERE EMPLOYEE_name='<‘raju’>’;

There are following some operators used in nested query.

The EXISTS :- This operator is used for checking the existences of value. The exists operator is take inner query as argument and return TRUE. If the query produces any return FALSE, otherwise.

The ANY :- This operator compares the lowest value in the result returned by the inner query.

The ALL :- This operator compares the lightest value in the result returned by the inner query.