- A correlated subquery is a subquery that depends on values from the outer query.
- It runs once for each row processed by the main query.
- This is useful when comparisons are needed at a row level.
- In my project, we used it to find orders higher than the customer’s average order value.
- The subquery referenced customer_id from the outer query.
- It makes logic clear but can impact performance on large datasets.
- We used it carefully and tested execution time before production.
What is a correlated subquery?
Updated on January 8, 2026
< 1 min read
