What is a correlated subquery?

SQL subqueries, CTEs and set operations · Freshers and experienced

Model answer

A subquery that refers to columns of the outer query, so it is evaluated for each outer row, such as employees earning more than the average of their own department. It can be slow on large data, and often can be rewritten with a join or a window function.

Learn this topic

Subqueries, EXISTS and CTEs: Queries Inside Queries in the course SQL for Beginners: Learn Databases Step by Step.

Sign in to add your own answer.

More questions