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

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?
118.View the Exhibit and examine the structure of the PROMOTIONS table._第1张图片
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之后进行过滤的,因此他们不一样

你可能感兴趣的:(1z0-051)