请教一道sql题目

[复制链接]
查看11 | 回复1 | 2010-6-24 08:35:22 | 显示全部楼层 |阅读模式
第7题
The INVENTORY table contains these columns:
ID_NUMBER NUMBER PK
DESCRIPTION VARCHAR2(30)
SUPPLIER_ID NUMBER
PRICE NUMBER(7,2)
QUANTITY NUMBER
Evaluate this SQL statement:
SELECT d_number, description, SUM(price) FROM inventory WHERE price > 30.00 GROUP BY id_number ORDER BY supplier_id;
Why will this statement cause an error?
(A) The PRICE column must be included in the GROUP BY clause.
(B) The ORDER BY clause should immediately follow the WHERE clause.
(C) The SUPPLIER_ID column is NOT included in the SELECT clause.
(D) The DESCRIPTION and SUPPLIER_ID columns are NOT included in the GROUP BY clause.
为什么选D?谢谢了

回复

使用道具 举报

千问 | 2010-6-24 08:35:22 | 显示全部楼层
分组函数啊,没有聚合函数的操作就要放在group by后面啊正确的应该是SELECT d_number, description,supplier_id, SUM(price) FROM inventory WHERE price > 30.00 GROUP BY id_number, description, supplier_idORDER BY supplier_id
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行