您的位置:首页 > 其它

118.View the Exhibit and examine the structure of the PROMOTIONS table.

2016-03-07 16:19 369 查看
118.View the Exhibit and examine the structure of the PROMOTIONS table.

Examine the following two SQL statements:

Statement 1

SQL>SELECT promo_category,SUM(promo_cost) FROM promotions

WHERE promo_end_date-promo_begin_date > 30

GROUP BY promo_category;

Statement 2

SQL>SELECT promo_category,sum(promo_cost) FROM promotions

GROUP BY promo_category

HAVING MIN(promo_end_date-promo_begin_date)>30;

Which statement is true regarding the above two SQL statements?



A.statement 1 gives an error, statement 2 executes successfully

B.statement 2 gives an error, statement 1 executes successfully

C.statement 1 and statement 2 execute successfully and give the same output

D.statement 1 and statement 2 execute successfully and give a different output

答案:D

解析:首先应该确定1和2执行都是正确的,1的条件在where中,是在group by之前进行过滤行

2的条件是在having中,是在group by之后进行过滤的,因此他们不一样
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: