QuestionQ13

VerifiedUsing Subqueries to Solve Queries

Examine the definition of the EMPLOYEES table:

Question Image

Examine the following query:

Question Image

Which line causes an error?

Explanation

A table alias is available only in the query block in which it is defined. Alias a is defined inside the subquery and cannot be used by the outer query’s select list; therefore a.avg_sal is invalid. A correlated subquery may reference e.department_id from its parent query block.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!