OCP-1Z0-051 第147题 CASE..WHEN的使用
2014-05-22 09:00
369 查看
一、原题
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.
答案:A
二、题目翻译
看下面PROMOTIONS表的结构.
评估下面的语句:
关于上面查询的结果哪句话是正确的?
A.显示所有promos 的COST_REMARK。
B.报错,因为子查询会出错。
C.显示promo category为TV的所有产品的COST_REMARK。
D.报错,因为子查询不能用于CASE表达式。
三、题目解析
子查询
SELECT AVG(promo_cost)
FROM promotions
WHERE promo_category = 'TV'
显示了TV的平均促销成本
CASE..WHEN的结果是,促销成本大于TV的平均促销成本的,显示为HIGH,否则显示为LOW。
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.
答案:A
二、题目翻译
看下面PROMOTIONS表的结构.
评估下面的语句:
关于上面查询的结果哪句话是正确的?
A.显示所有promos 的COST_REMARK。
B.报错,因为子查询会出错。
C.显示promo category为TV的所有产品的COST_REMARK。
D.报错,因为子查询不能用于CASE表达式。
三、题目解析
子查询
SELECT AVG(promo_cost)
FROM promotions
WHERE promo_category = 'TV'
显示了TV的平均促销成本
CASE..WHEN的结果是,促销成本大于TV的平均促销成本的,显示为HIGH,否则显示为LOW。
相关文章推荐
- OCP-1Z0-051 第103题 CASE.. WHEN,TO_CHAR,TRIM的用法
- OCP-1Z0-051 第101题 DECODE,COUNT,CASE WHEN,SUM的使用
- OCP-1Z0-051 第108题 COUNT函数使用注意事项
- OCP-1Z0-051 第166题 使用子查询update表中的多列
- OCP-1Z0-051 补充题库 第41题 nvl函数的使用
- OCP-1Z0-051 补充题库 第4题 聚合函数的使用
- OCP-1Z0-051 第148题 子查询和ANY,ALL的使用
- OCP-1Z0-051 第168题 使用子查询DELETE数据
- OCP-1Z0-051 第160题 insert中使用子查询
- OCP-1Z0-051 补充题库 第40题 聚合函数的使用
- OCP-1Z0-051 第106题 COALESCE,DECODE,NVL,NULLIF函数的使用
- OCP-1Z0-051 第136题 子查询的使用
- OCP-1Z0-051 第110题 AVG的使用
- OCP-1Z0-051 第169题 使用子查询DELETE数据
- OCP-1Z0-051 第64题 order by使用别名注意事项
- OCP-1Z0-051 第107题 AVG,MAX,MIN组函数的使用
- OCP-1Z0-051 第128题 LEFT OUTER JOIN,RIGHT OUTER JOIN的使用
- OCP-1Z0-051 第129题 RIGHT OUTER JOIN的使用
- OCP-1Z0-051 补充题库 第8题 子查询的使用范围
- OCP-1Z0-051 补充题库 第1题 TRUNCATE命令的使用