Skip to main content

Non-Correlated Subqueries

These are subqueries that are self-contained, in that they can be executed independently of the surrounding query.
Non-Correlated Subquery in SELECT Example
Non-Correlated Subquery in FROM Example
Non-Correlated Subquery in WHERE Example

Correlated Subqueries

These are subqueries that depend on the values in the surrounding query, and cannot be executed independently of the surrounding query.
Correlated Subquery Example
Correlated subqueries have the following limitations:
  • They cannot reference grouping columns in the parent query
  • They cannot reference tables beyond the immediate outer query; i.e., a table cannot be referenced in a correlated subquery that is two or more levels of nesting deeper than it is
  • They cannot contain disjunctive conditions
  • They cannot be part of an OUTER JOIN ON clause condition