QuestionQ171

VerifiedUsing Subqueries to Solve Queries

Refer to the exhibit and review the structure of the CUSTOMERS table.

Exhibit:

Question Image

You issue the following SQL statement on the CUSTOMERS table to display customers who are in the same country as customers whose last name is 'king', and whose credit limit is less than the maximum credit limit in countries containing customers whose last name is 'king'.

Question Image

Which statement is true about the result of the preceding query?

Explanation

IN correctly tests membership against the set of country IDs returned for customers named King. MAX(cust_credit_limit) returns a single aggregate value, making the nested query a valid scalar subquery for comparison with <; therefore, neither ANY nor ALL is required. The query returns customers in those countries whose credit limit is below that maximum.

Learn more

Community Discussion

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