OCP-1Z0-051 第149题 子查询中ALL的应用
2014-05-22 13:45
411 查看
一、原题
View the Exhibits and examine the structures of the COSTS and PROMOTIONS tables.
Evaluate the following SQL statement:
SQL>SELECT prod_id
FROM costs
WHERE promo_id IN
(SELECT promo_id
FROM promotions
WHERE promo_cost < ALL
(SELECT MAX(promo_cost)
FROM promotions
GROUP BY (promo_end_date - promo_begin_date)));
What would be the outcome of the above SQL statement?
A. It displays prod IDs in the promo with the lowest cost.
B. It displays prod IDs in the promos with the lowest cost in the same time interval.
C. It displays prod IDs in the promos with the highest cost in the same time interval.
D. It displays prod IDs in the promos with cost less than the highest cost in the same time interval.
答案:D
二、题目翻译
查看COSTS and PROMOTIONS表的结构.
评估下面的SQL语句
上面SQL的执行结果什么?
A.显示promo最低的prod IDs。
B.显示相同时间段内promo最低的prod IDs。
C.显示相同时间段内promo最高的prod IDs。
D.显示相同时间段内promo的cost小于最高的cost的prod IDs。
三、题目解析
子查询
SELECT MAX(promo_cost)
FROM promotions
GROUP BY (promo_end_date - promo_begin_date)
求出来的,是每个促销活动期间内的最大的成本。
然后 promo_cost < ALL(.. ),表示小于 刚子查询查出来的所有这些最大成本结果集中,最小的那个。
然后,再根据活动ID,查出产品ID。
D选项中,描述也不是太准确,但是在几个选项的描述中,D是最接近的。
View the Exhibits and examine the structures of the COSTS and PROMOTIONS tables.
Evaluate the following SQL statement:
SQL>SELECT prod_id
FROM costs
WHERE promo_id IN
(SELECT promo_id
FROM promotions
WHERE promo_cost < ALL
(SELECT MAX(promo_cost)
FROM promotions
GROUP BY (promo_end_date - promo_begin_date)));
What would be the outcome of the above SQL statement?
A. It displays prod IDs in the promo with the lowest cost.
B. It displays prod IDs in the promos with the lowest cost in the same time interval.
C. It displays prod IDs in the promos with the highest cost in the same time interval.
D. It displays prod IDs in the promos with cost less than the highest cost in the same time interval.
答案:D
二、题目翻译
查看COSTS and PROMOTIONS表的结构.
评估下面的SQL语句
上面SQL的执行结果什么?
A.显示promo最低的prod IDs。
B.显示相同时间段内promo最低的prod IDs。
C.显示相同时间段内promo最高的prod IDs。
D.显示相同时间段内promo的cost小于最高的cost的prod IDs。
三、题目解析
子查询
SELECT MAX(promo_cost)
FROM promotions
GROUP BY (promo_end_date - promo_begin_date)
求出来的,是每个促销活动期间内的最大的成本。
然后 promo_cost < ALL(.. ),表示小于 刚子查询查出来的所有这些最大成本结果集中,最小的那个。
然后,再根据活动ID,查出产品ID。
D选项中,描述也不是太准确,但是在几个选项的描述中,D是最接近的。
相关文章推荐
- OCP-1Z0-051 第143题 子查询中ANY、ALL的应用
- OCP-1Z0-051 第144题 子查询的应用
- OCP-1Z0-051 第148题 子查询和ANY,ALL的使用
- OCP-1Z0-051 第137题 子查询的应用
- OCP-1Z0-051 第138题 not操作,IN、ANY、ALL的应用
- OCP-1Z0-051 第141题 子查询的应用
- OCP-1Z0-051 第142题 嵌套子查询的应用
- OCP-1Z0-051 第168题 使用子查询DELETE数据
- OCP-1Z0-051 第113题 GROUP BY, TO_CHAR的应用
- OCP-1Z0-051 第135题 子查询注意事项
- OCP-1Z0-051 第139题 子查询的注意事项
- OCP-1Z0-051 第116题 GROUP BY,HAVING子句应用
- OCP-1Z0-051 补充题库 第9题 to_char将数字转成字符的格式应用
- OCP-1Z0-051 第165题 使用子查询update多列数据
- OCP-1Z0-051 第114题 HAVING,GROUP BY子句的应用
- OCP-1Z0-051 补充题库 第5题 主查询和子查询的注意事项
- OCP-1Z0-051 补充题库 第15题 子查询和join
- OCP-1Z0-051 第133题 子查询的用法
- OCP-1Z0-051 第63题 order by 应用
- OCP-1Z0-051 第125题 self-join(自连接)和self-join(子查询)