Multiple choice technology databases

Which of the following is a correlated subquery?

  1. Uses the result of an inner query to determine the processing of an outer query.

  2. Uses the result of an outer query to determine the processing of an inner query.

  3. Uses the result of an inner query to determine the processing of an inner query.

  4. Uses the result of an outer query to determine the processing of an outer query.

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

A correlated subquery is one where the inner query references a value from the outer query, making it dependent on the outer query's results. The inner query is executed repeatedly for each row processed by the outer query. This is the opposite of a non-correlated subquery, which runs independently once.

AI explanation

A correlated subquery is one where the inner (sub)query references a column from the outer query, so the inner query must be re-evaluated once per row processed by the outer query — i.e., the outer query's row values determine/drive the processing of the inner query. This is the reverse of a typical (non-correlated) subquery, where the inner query runs once, independently, and its result feeds the outer query. The other options either describe a normal nested subquery or reverse/garble the relationship.