【OCP-12c】CUUG最新考試原題整理及答案(071-9)
阿新 • • 發佈:2019-02-15
oos display mine bit _id group by ocp store tables 9、(5-5) choose the best answer
View the Exhibit and examine the structure of the SALES and STORES tables.
You want to display the store name and the total quantity sold for each item in the store. ON (s1.store_id = str.store_id)
GROUP BY str.name, s1.items_id, s1.quantity; GROUP BY sls.store_id)
FROM sales s1 JOIN stores str
ON (s1.store_id = str.store_id);
View the Exhibit and examine the structure of the SALES and STORES tables.
You want to display the store name and the total quantity sold for each item in the store.
Which SQL statement will give the required output?
A) SELECT str.name, s1.items_id, SUM(s1.quantity)
FROM sales s1 JOIN stores str
GROUP BY str.name, s1.items_id, s1.quantity;
B) SELECT str.name, s1.items_id, SUM(s1.quantity)
FROM sales s1 JOIN stores str
ON (s1.store_id = str.store_id)
GROUP BY str.name, s1.items_id;
C) SELECT str.name, s1.items_id,
(SELECT SUM(quantitY)
FROM sales sls
ON sls.store_id = s1.store_id
FROM sales s1 JOIN stores str
ON (s1.store_id = str.store_id);
D) SELECT str.name, s1.items_id, SUM(s1.quantity)
FROM sales s1 JOIN stores str ON (s1.store id = str.store_id)
GROUP BY s1.items_id, s1.quantity;
Answer:B
(解析:分組函數的最基本特點,沒有出現在分組函數中的列必須要出現在 group by 子句中。)
【OCP-12c】CUUG最新考試原題整理及答案(071-9)