Correlated Subqueries

suggest change

Correlated (also known as Synchronized or Coordinated) Subqueries are nested queries that make references to the current row of their outer query:

SELECT EmployeeId
    FROM Employee AS eOuter
    WHERE Salary > (
       SELECT AVG(Salary)
       FROM Employee eInner
       WHERE eInner.DepartmentId = eOuter.DepartmentId
    )

Subquery SELECT AVG(Salary) ... is correlated because it refers to Employee row eOuter from its outer query.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:


Subqueries:
*Correlated Subqueries

Table Of Contents