QuestionQ16

VerifiedUsing Subqueries to Solve Queries

Refer to the exhibit and review the structures of the CUSTOMERS and GRADES tables:

Question Image

You must display the names and grades of customers with the highest credit limit. Which two SQL statements accomplish this task?

Choose two
Explanation

The maximum credit limit can be found with the scalar subquery SELECT MAX(cust_credit_limit) FROM customers. One valid approach uses that maximum to identify the applicable grade range and selects customers whose credit limits are in that range. Another directly restricts customer rows to the maximum credit limit and joins each such row to the grade range containing its credit limit. The BETWEEN startval AND endval predicate maps a credit limit to its grade interval.

Community Discussion

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