QuestionQ167

VerifiedUsing Subqueries to Solve Queries

The exhibit shows the structure of the PRODUCTS table:

Question Image

Evaluate this query:

Question Image

What is the result of executing the SQL statement?

Explanation

The inner MAX obtains the highest list price, and the enclosing MAX obtains the greatest price below it—the second-highest distinct list price. Products whose PROD_LIST_PRICE equals that value are selected, so their names are returned. Oracle permits a subquery in an IN condition, and aggregate functions without GROUP BY return a value over the filtered rows.

Learn more

Community Discussion

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