141. View the Exhibitand examine the structure of CUSTOMERS and GRADES tables.
You need to displaynames and grades of customers who have the highest credit limit.
Which two SQL statementswould accomplish the task (Choose two.)
A. SELECT custname,grade
FROM customers, grades
WHERE (SELECTMAX(cust_credit_limit)
FROM customers) BETWEENstartval and endval;
B. SELECT custname,grade
FROM customers, grades
WHERE (SELECT MAX(cust_credit_limit)
FROM customers)

A. SELECT custname,grade
FROM customers, grades
WHERE (SELECTMAX(cust_credit_limit)
FROM customers) BETWEENstartval and endval;
B. SELECT custname,grade
FROM customers, grades
WHERE (SELECTMAX(cust_credit_limit)
FROM customers) BETWEENstartval and endval
AND cust_credit_limitBETWEEN startval AND endval;
C. SELECT custname,grade
FROM customers, grades
WHERE cust_credit_limit= (SELECT MAX(cust_credit_limit)
FROM customers)
AND cust_credit_limitBETWEEN startval AND endval;
D. SELECT custname,grade
FROM customers , grades
WHERE cust_credit_limitIN (SELECT MAX(cust_credit_limit)
FROM customers)
ANDMAX(cust_credit_limit) BETWEEN startval AND endval;
Answer: BC
解析:
题意:You need to display names and grades of customers whohave the highest credit limit 意思要求找出最高credit limit 但是须在startval endval 之间,执行where后的条件从右到左
142. View the Exhibitand examine the structure of the PRODUCTS table.
eva luate the followingquery:
SQL> SELECT prod_name
FROM products
WHERE prod_id IN (SELECTprod_id FROM products
WHERE prod_list_price =
(SELECT MAX(prod_list_price)FROM products
WHERE prod_list_price <
(SELECT MAX(prod_list_price)FROM products)));
What would be theoutcome of executing the above SQL statement

A. It produces an error.
B. It shows the names ofall products in the table.
C. It shows the names ofproducts whose list price is the second highest in the table.
D. It shows the names ofall products whose list price is less than the maximum list price.
Answer: C
解析:
(SELECT MAX(prod_list_price)FROMproducts
WHERE prod_list_price<
(SELECTMAX(prod_list_price)FROM products))
从小于最大价格的结果集找最大的结果,那就是第二大的
143. View the Exhibitand examine the structure of the PROMOTIONS table.
You have to generate areport that displays the promo name and start date for all promos that startedafter
the last promo in the'INTERNET' category.
Which query would giveyou the required output

A. SELECT promo_name,promo_begin_date FROM promotions
WHERE promo_begin_date> ALL (SELECT MAX(promo_begin_date)
FROM promotions )AND
promo_category ='INTERNET';
B. SELECT promo_name,promo_begin_date FROM promotions
WHERE promo_begin_dateIN (SELECT promo_begin_date
FROM promotions
WHEREpromo_category='INTERNET');
C. SELECT promo_name,promo_begin_date FROM promotions
WHERE promo_begin_date> ALL (SELECT promo_begin_date
FROM promotions
WHERE promo_category ='INTERNET');
D. SELECT promo_name,promo_begin_date FROM promotions
WHERE promo_begin_date> ANY (SELECT promo_begin_date
FROM promotions
WHERE promo_category ='INTERNET');
Answer: C
解析:
(SELECT promo_begin_date
FROM promotions
WHERE promo_category ='INTERNET');
得到类别为internet的所有promo_begin_date
SELECT promo_name,promo_begin_date FROM promotions
WHERE promo_begin_date> ALL (SELECT promo_begin_date
FROM promotions
WHERE promo_category ='INTERNET');
大于所有的类别为internet的所有promo_begin_date,即大于最大的,也就是最近的
时间的比较,越大说明离当