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

Which column in the user.triggers data dictionary view shows that the trigger is a pl/sql trigger?

594


What is the difference between between and in condition operators?

530


What is the difference between joins?

532


When are we going to use truncate and delete?

549


How do I find duplicates in the same column?

529






What is data control language?

526


what is a relationship and what are they? : Sql dba

548


What do you understand by pl/sql records?

528


How to change a value of the field ‘salary’ as 7500 for an employee_name ‘john’ in a table employee_details?

898


What is hibernate and its relation to sql?

587


how to shutdown mysql server? : Sql dba

563


What does sign mean sql?

563


Which certification is best for sql?

532


How insert into statements in sql?

586


Why coalesce is used in sql?

469