beginnerSubqueries, EXISTS & Correlated Subqueries

What is the difference between a correlated and non-correlated subquery?

Non-correlated subquery: independent of the outer query. It executes ONCE and its result is used by the outer query. Example: WHERE salary > (SELECT AVG(salary) FROM employees) — inner query runs once, returns one value. Correlated subquery: references columns from the outer query. It executes ONCE FOR EACH ROW of the outer query. Example: WHERE salary > (SELECT AVG(salary) FROM employees e2 WHERE

This is a Pro chapter

Sign in, then upgrade to Pro or Power to unlock this and the full Databases Mastery library.

What is the difference between a correlated and non-correlated subquery?

Next Step

Continue to What is the difference between IN and EXISTS?← Back to all SQL questions