me time interval.
Answer: D
解析:
GROUP BY (promo_end_datepromo_
begin_date)
表示以这个时间段分组
150. View the Exhibitand examine the data in the PROMOTIONS table.
You need to display allpromo categories that do not have 'discount' in their subcategory.
Which two SQL statementsgive the required result (Choose two.)

A. SELECTpromo_category
FROMpromotions
MINUS
SELECTpromo_category
FROMpromotions
WHEREpromo_subcategory = 'discount';
B. SELECTpromo_category
FROMpromotions
INTERSECT
SELECTpromo_category
FROMpromotions
WHEREpromo_subcategory = 'discount';
C. SELECTpromo_category
FROMpromotions
MINUS
SELECTpromo_category
FROMpromotions
WHEREpromo_subcategory <> 'discount';
D. SELECTpromo_category
FROMpromotions
INTERSECT
SELECTpromo_category
FROMpromotions
WHEREpromo_subcategory <> 'discount';
Answer: AD
解析:
MINUS,引用官方文档:
The following statementcombines results with the MINUS operator,
which returns onlyunique rows returned by the first query but not by the second:
INTERSECT
这个值要存在于第一句和第二句才会被选出,相当于两个查询的结果的交集
151. View the Exhibitand examine the structure of the CUSTOMERS and CUST_HISTORY tables.
The CUSTOMERS tablecontains the current location of all currently active customers. The
CUST_HISTORY tablestores historical details relating to any changes in the location of allcurrent as well
as previous customerswho are no longer active with the company.
You need to find thosecustomers who have never changed their address.
Which SET operator wouldyou use to get the required output

A. MINUS
B. UNION
C. INTERSECT
D. UNION ALL
Answer: A
解析:
题意:find thosecustomers who have never changed their address
所有的customers减去已经改变地址customers就等于没有改变地址的顾客
所以用运算符 minus,引用官方文档:
The followingstatement combines results with the MINUS operator,
which returnsonly unique rows returned by the first query but not by the second:
152. Which statement istrue regarding the UNION operator
A. By default, theoutput is not sorted.
B. NULL values are notignored during duplicate checking.
C. Names of all columnsmust be identical across all SELECT statements.
D. The number of columnsselected in all SELECT statements need not be the same.
Answer: B
解析:
引用官方文档:
UNION Example The following statement combines the results of two queries with
the UNION operator,which eliminates duplicate selected rows. This statement shows
that you must match datatype (using the TO_CHAR function) when columns do not
exist in one or theother table:
SELECT location_id,department_name "Department",
TO_CHAR(NULL)"Warehouse" FROM departments
UNION
SELECT location_id,TO_CHAR(NULL) "Department", warehouse_name
FROM warehouses;
LOCATION_ID DepartmentWarehouse
----------------------------------------- ---------------------------
1400 IT
1400 Southlake, Texas
1500 Shipping
1500 San Francisco
1600 New Jersey
153. View the Exhibitsand examine the structures of the PRODUCTS and SALES tables.
Which two SQL statementswould give the same output (Choose two.)
A. SELECT prod_id FROMproducts
INTERSECT
SELECT prod_id FROMsales;
B. SELECT prod_id FROMproducts
MINUS
SELECT prod_id FROMsales;
C. SELECT DISTINCTp.prod_id
FROM products pJOIN sales s
ONp.prod_id=s.prod_id;
D. SELECT DISTINCTp.prod_id
FROM products p JOINsales s
ON p.prod_id <>s.prod_id;
Answer: AC
解析:
INTERSECT
这个值要存在于第一句和第二句才会被选出,相当于两个查询的结果的交集
所以A选项的结果是
SELECT prod_id FROMproducts
SELECT prod