What is correlated sub-query?

Answer Posted / bis

A query which uses values from the outer query is called as a correlated sub query. The subquery is executed once and uses the results for all the evaluations in the outer query.

Here, the sub query references the employee_id in outer query. The value of the employee_id changes by row of the outer query, so the database must rerun the subquery for each row comparison. The outer query knows nothing about the inner query except its results.

select employee_id, appraisal_id, appraisal_amount From employee
where
appraisal_amount < (select max(appraisal_amount)
from employee e
where employee_id = e. employee_id);

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do I save the results of sql query in a file?

711


What is oracle and pl sql?

829


what is blob? : Sql dba

742


How do you remove duplicates without using distinct in sql?

695


What is not in sql?

667






Which kind of parameters cannot have a default value in pl sql?

805


What is a pdo connection?

685


Is hadoop a nosql?

745


What are different sql data types?

685


How to revise and re-run the last sql command?

837


What is server name sql?

803


how do you know if your mysql server is alive? : Sql dba

778


what happens when the column is set to auto increment and you reach the maximum value for that table? : Sql dba

765


how do you know the version of your mysql server? : Sql dba

690


What is linq to sql?

772