OCP 1Z0 051 147
来源:互联网 发布:英镑欧元知乎 编辑:程序博客网 时间:2024/05/22 12:53
147. View the Exhibit and examine the structure of the PROMOTIONS table.
Evaluate the following SQL statement:
SQL>SELECT promo_name,CASE
WHEN promo_cost >=(SELECT AVG(promo_cost)
FROM promotions
WHERE promo_category='TV')
then 'HIGH'
else 'LOW'
END COST_REMARK
FROM promotions;
Which statement is true regarding the outcome of the above query?
A. It shows COST_REMARK for all the promos in the table.
B. It produces an error because the subquery gives an error.
C. It shows COST_REMARK for all the promos in the promo category 'TV'.
D. It produces an error because subqueries cannot be used with the CASE expression.
该子查询是在select后 from 前,这种叫标量子查询。
Answer: A
Evaluate the following SQL statement:
SQL>SELECT promo_name,CASE
WHEN promo_cost >=(SELECT AVG(promo_cost)
FROM promotions
WHERE promo_category='TV')
then 'HIGH'
else 'LOW'
END COST_REMARK
FROM promotions;
Which statement is true regarding the outcome of the above query?
A. It shows COST_REMARK for all the promos in the table.
B. It produces an error because the subquery gives an error.
C. It shows COST_REMARK for all the promos in the promo category 'TV'.
D. It produces an error because subqueries cannot be used with the CASE expression.
该子查询是在select后 from 前,这种叫标量子查询。
有匹配数据时显示一个值,没有数据时显示null
不影响主查询的行数
SQL> SELECT promo_name, 2 CASE 3 WHEN promo_cost >= (SELECT AVG(promo_cost) 4 FROM sh.promotions 5 WHERE promo_category = 'TV') THEN 6 'HIGH' 7 ELSE 8 'LOW' 9 END cost_remark 10 FROM sh.promotions 11 WHERE rownum <= 5;PROMO_NAME COST_REMARK------------------------------ -----------NO PROMOTION # LOWnewspaper promotion #16-108 LOWpost promotion #20-232 LOWnewspaper promotion #16-349 LOWinternet promotion #14-471 LOW5 rows selected
SQL> SELECT COUNT(*) 2 FROM (SELECT promo_name, 3 CASE 4 WHEN promo_cost >= 5 (SELECT AVG(promo_cost) 6 FROM sh.promotions 7 WHERE promo_category = 'TV') THEN 8 'HIGH' 9 ELSE 10 'LOW' 11 END cost_remark 12 FROM sh.promotions); COUNT(*)---------- 5031 row selected
SQL> SELECT COUNT(*) FROM sh.promotions; COUNT(*)---------- 5031 row selected
Answer: A
0 0
- OCP 1Z0 051 147
- OCP 1Z0 052 147
- OCP 1Z0 053 147
- OCP 1Z0 051 1
- OCP 1Z0 051 2
- OCP 1Z0 051 3
- OCP 1Z0 051 4
- OCP 1Z0 051 5
- OCP 1Z0 051 6
- OCP 1Z0 051 7
- OCP 1Z0 051 8
- OCP 1Z0 051 9
- OCP 1Z0 051 10
- OCP 1Z0 051 11
- OCP 1Z0 051 12
- OCP 1Z0 051 13
- OCP 1Z0 051 14
- OCP 1Z0 051 15
- MD5加密,用户名、密码、时间戳组成
- java 后台验收身份证方法
- PHP网站301定向方法详解
- boost log库
- 简介ImageLoader(一)
- OCP 1Z0 051 147
- JavaScript高级程序设计之元素大小
- 简洁的C debug方法
- 程序员编程艺术学习笔记(五):寻找满足和为定值的两个或多个数
- 前端浏览器兼容性问题汇总,持续更新中。。。。
- AS3 五子棋源码
- 基于HBASE的并行计算架构之rowkey设计篇
- 医学词汇
- vs下sscanf_s报错