Bird
0
0

What happens when a correlated subquery is executed in SQL?

easy📝 Conceptual Q1 of 15
SQL - Subqueries
What happens when a correlated subquery is executed in SQL?
AThe subquery runs only once before the outer query
BThe subquery runs independently without referencing the outer query
CThe subquery runs after the outer query completes
DThe subquery runs once for each row of the outer query
Step-by-Step Solution
Solution:
  1. Step 1: Understand correlated subquery execution

    A correlated subquery depends on the outer query's current row, so it must run repeatedly for each row.
  2. Step 2: Compare execution models

    Unlike a simple subquery that runs once, a correlated subquery executes once per outer row to use that row's data.
  3. Final Answer:

    The subquery runs once for each row of the outer query -> Option D
  4. Quick Check:

    Correlated subquery execution = runs per outer row [OK]
Quick Trick: Correlated subqueries run repeatedly per outer row [OK]
Common Mistakes:
MISTAKES
  • Thinking subquery runs only once
  • Confusing correlated with non-correlated subqueries
  • Assuming subquery runs after outer query

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes