136. View the Exhibit and examine the structure of the PRODUCTS table.
Which two tasks would require subqueries? (Choose two.)
A. Display the minimum list price for each product status.
B. Display all suppliers whose list price is less than 1000.
C. Display the number of products whose list price is more than the average list price.
D. Display the total number of products supplied by supplier 102 and have product status as 'obsolete'.
E. Display all products whose minimum list price is more than the average list price of products and have
the status 'orderable'.
Answer: CE
答案解析:
参考:http://blog.csdn.net/rlhua/article/details/12879585
题意要求两个需要使用子查询的。
A,显示每个product status的minimum list price,可以使用group by product status来找出 minimum list price
B,显示所有价格低于1000的供应商,找出供应商的价格,选择价格低于1000的,不需要使用子查询
C,显示产品价格大于平均价格的产品数量,首先需要计算出平均价格,然后在找出产品价格大于平均价格的数量,需要使用子查询。
D,显示102供应商供应的并且产品状态为'obsolete'的全部产品数量,直接查询,不需要使用子查询
E,显示产品的最低价格大于平均价格并且产品状态是'orderable'的所有产品,首先计算出平均价格,然后使用min()函数找出最低价格来比较品均价格以及状态是'orderable'的所有产品,需要使用到子查询。