Multiple choice technology databases

The Query has Main and Sub Query. If the main query returns 10 records and subquery returns 5 records, then how many times the subquery gets executed?

  1. 10

  2. 1

  3. 5

  4. 50

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

For a non-correlated subquery (the standard case implied by the wording), the subquery executes once and returns its result set to be used by the main query. The main query then filters its 10 records using the 5 records from the subquery. Only a correlated subquery would execute once per main query row (10 times), but the question does not specify correlation.