Chinaunix首页 | 论坛 | 博客
  • 博客访问: 673887
  • 博文数量: 487
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 4936
  • 用 户 组: 普通用户
  • 注册时间: 2018-07-05 13:59
个人简介

ocp考试资料群:569933648 验证码:ocp OCP 12c 19c考试题库解析与资料群:钉钉群号:35277291

文章分类

全部博文(487)

文章存档

2024年(2)

2023年(37)

2021年(151)

2020年(37)

2019年(222)

2018年(38)

我的朋友

分类: Oracle

2019-02-26 15:17:08

19.choose the best answer

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 promo category 'TV' .

B) It produces an error because subqueries cannot be used with the CASE expression.

C) It shows COST_REMARK for all the promos in the table.

D) It produces an error because the subquery gives an error.

Answer:C

(解析:category 'TV'只是判定 promo_cost 的一个条件,显示的是所有 category 的内容。

使用如下语句验证:

SELECT promo_name,promo_category,CASE

WHEN promo_cost>=(SELECT AVG(promo_cost)

FROM promotions

WHERE promo_category= 'TV')

THEN 'HIGH'

ELSE 'LOW'

END COST_REMARK

FROM promotions

where rownum < 30;


)

阅读(953) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~