首页 > 数据库 > Oracle > OCP 1Z0 051 137
You issue the following query to display product name and the number of times the product has been sold:
|
SELECT p.prod_name, i.item_cnt FROM (SELECT prod_id, COUNT(*) item_cnt FROM sales GROUP BY prod_id) i RIGHT OUTER JOIN products p ON i.prod_id = p.prod_id; |
What happens when the above statement is executed?
A. The statement executes successfully and produces the required output.
B. The statement produces an error because ITEM_CNT cannot be displayed in the outer query.
C. The statement produces an error because a subquery in the FROM clause and outer-joins cannot be used together.
D. The statement produces an error because the GROUP BY clause cannot be used in a subquery in the FROM clause.
答案:(A)
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/17013648/viewspace-1169634/ ,如需转载,请注明出处,否则将追究法律责任。