OCP-1Z0-051 第18题 distinct用法

时间:2021-08-23 08:29:58
一、原题
Examine the structure of the PROMOTIONS table:
name              Null        Type
PROMO_ID         NOT NULL   NUMBER(6)
PROMO_NAME       NOT NULL   VARCHAR2(30)
PROMO_CATEGORY   NOT NULL   VARCHAR2(30)
PROMO_COST       NOT NULL   NUMBER(10,2)

The management wants to see a report of unique promotion costs in each promotion category.
Which query would achieve the required result?
A. SELECT DISTINCT promo_cost, promo_category FROM promotions;
B. SELECT promo_category, DISTINCT promo_cost FROM promotions;
C. SELECT DISTINCT promo_cost, DISTINCT promo_category FROM promotions;
D. SELECT DISTINCT promo_category, promo_cost FROM promotions;

答案:D

二、题目翻译
下面是PROMOTIONS的表结构
管理人员想看一个报表,显示每一个促销种类唯一的促销成本。
哪一个查询能获得所需结果?

三、题目解析
A选项,会出结果,但结果是每一个促销成本,有哪些促销种类,不是我们想要的结果。
B,C选项,语法不正确,会报错。
D正确。