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之后进行过滤的,因此他们不一样
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之后进行过滤的,因此他们不一样
相关文章推荐
- 思科、华为、H3C常用命令对比大全
- 数据结构基本查找算法
- ZjDroid工具介绍及脱壳详细示例
- Android ViewPager使用详解
- 关于百度云、极光的推送的问题,为什么控制台发送消息成功,而手机端接收不到消息
- android逆向分析中常用的smali注入代码
- git上传自己的代码
- Javascript闭包
- 【Java开发者自学笔记】从A至Z的路径规划
- Bloom Filter概念和原理
- Android WebView实现原生与JS的交互
- Andriod Activity和Service同一线程的情况和不在同一线程的情况
- Android应用与系统安全防御
- redis的安装以及基础知识
- ProtocolBuffer + MySQL++实现消息反射查询返回数据
- android 与H5交互之使用GPS定位
- leetcode:Rotate Array 【Java】
- 华为机试题02(2015)
- 三、服务器和客户端的信息函数
- dogwood