Categories
All Categories
DMV
ServSafe
OSHA
NCLEX
HESI
TEAS
ATI Nursing
CNA & Nurse Aide
NREMT & EMS
ACLS
BLS
CPR
Quizzes
Study Guides
Flashcards
Packages
0
Log In
Register
Categories
All Categories
DMV
ServSafe
OSHA
NCLEX
HESI
TEAS
Quizzes
Study Guides
Flashcards
Packages
Contact
Cart
0
Log In
Register
SQL Basics Practice Test
Access More Questions
Report question problem
×
I think the answer is wrong
There are multiple correct answers
There is a typing error
Image or comprehension text is not display properly
Something else(please specify below)
Any more information
Which description best defines a correlated subquery?
A subquery that does not reference the outer query
A subquery that is executed only once
A subquery that is evaluated for each row of the outer query
A subquery that uses an aggregate function
Reveal Answer
Correct Answer:
A subquery that is evaluated for each row of the outer query
Explanation:
A correlated subquery is a subquery that references a column from the outer query, so it must be evaluated for each row of the outer query. Because the inner query depends on values from the current outer row, the database re-runs it for every row, using that row’s data to determine the condition. This is why you often see correlations in EXISTS or in comparisons that relate the outer row to related data. For example, a query that asks for employees whose salary is above the average salary in their own department uses the department value from the outer row inside the inner query, making the inner query depend on each outer row. In contrast, a non-correlated subquery does not reference outer columns and can be executed just once, producing a result that the outer query uses later. An inner query that uses an aggregate or doesn’t reference outer values isn’t by itself a correlation; the key idea is the dependency on the outer query’s current row.
Access more questions from this quiz
Continue to SQL Basics Practice Test for more practice questions and the full quiz experience.
Access More Questions