Number of questions 1,751
Number of tests completed 252,581
Number of questions answered 3,766,821
Number of registered users 19,177
Sign In | Register
Skip Navigation Links
Question: A query within a query where the inner query is evaluated for each row in the outer query is called?
Answer1: Join
Answer2: View
Answer3: Correlated subquery
Answer4: None of the above
Answer: Correlated subquery

Explaination: In a SQL database query, a correlated sub-query (also known as a synchronized subquery) is a sub-query (a query nested inside another query) that uses values from the outer query in its WHERE clause. The sub-query is evaluated once for each row processed by the outer query. Here is an example for a typical correlated sub-query. In this example we are finding the list of employees (employee number and names) having more salary than the average salary of all employees in that employee's department SELECT employee_number, name FROM employee AS e1 WHERE salary > (SELECT avg(salary) FROM employee WHERE department = e1.department);

Correctly answered: 4650
Incorrectly answered: 1556
Terms of Use Ver. 2.0.6783.38332