92. View the E xhibit and examine the data in the PROMO_NAME and PROMO_END_DATE columns of
the PROMOTIONS table, and the required output format.
Which two queries give the correct result? (Choose two.)
A. SELECT promo_name, TO_CHAR(promo_end_date,'Day') || ', ' || TO_CHAR(promo_end_date,'Month') || ' ' || TO_CHAR(promo_end_date,'DD, YYYY') AS last_day
FROM promotions;
B. SELECT promo_name,TO_CHAR (promo_end_date,'fxDay') || ', ' || TO_CHAR(promo_end_date,'fxMonth') || ' ' || TO_CHAR(promo_end_date,'fxDD, YYYY') AS last_day
FROM promotions;
C. SELECT promo_name, TRIM(TO_CHAR(promo_end_date,'Day')) || ', ' || TRIM(TO_CHAR(promo_end_date,'Month')) || ' ' || TRIM(TO_CHAR(promo_end_date,'DD, YYYY')) AS last_day
FROM promotions;
D. SELECTpromo_name,TO_CHAR(promo_end_date,'fmDay')|| ',' || TO_CHAR(promo_end_date,'fmMonth') || ' ' || TO_CHAR(promo_end_date,'fmDD, YYYY') AS last_day
FROM promotions;
fx 精确匹配,演示如下
to_char(,'Month') 会产生空格,需要去掉空格
Answer: CD
the PROMOTIONS table, and the required output format.
Which two queries give the correct result? (Choose two.)
A. SELECT promo_name, TO_CHAR(promo_end_date,'Day') || ', ' || TO_CHAR(promo_end_date,'Month') || ' ' || TO_CHAR(promo_end_date,'DD, YYYY') AS last_day
FROM promotions;
B. SELECT promo_name,TO_CHAR (promo_end_date,'fxDay') || ', ' || TO_CHAR(promo_end_date,'fxMonth') || ' ' || TO_CHAR(promo_end_date,'fxDD, YYYY') AS last_day
FROM promotions;
C. SELECT promo_name, TRIM(TO_CHAR(promo_end_date,'Day')) || ', ' || TRIM(TO_CHAR(promo_end_date,'Month')) || ' ' || TRIM(TO_CHAR(promo_end_date,'DD, YYYY')) AS last_day
FROM promotions;
D. SELECTpromo_name,TO_CHAR(promo_end_date,'fmDay')|| ',' || TO_CHAR(promo_end_date,'fmMonth') || ' ' || TO_CHAR(promo_end_date,'fmDD, YYYY') AS last_day
FROM promotions;
fx 精确匹配,演示如下
SQL> select to_date('2015-05-01','yyyy- mm - dd') from dual;
TO_DATE('2015-05-01','YYYY-MM-
------------------------------
2015-5-1
1 row selected
Executed in 0.016 seconds
SQL> select to_date('2015-05-01','fx yyyy- mm - dd') from dual;
select to_date('2015-05-01','fx yyyy- mm - dd') from dual
to_char(,'Month') 会产生空格,需要去掉空格
SQL> select to_char(sysdate,'month') || '|' from dual;
TO_CHAR(SYSDATE,'MONTH')||'|'
-----------------------------
may |
SQL> SELECT promo_name,
2 TRIM(to_char(promo_end_date, 'Day')) || ', ' ||
3 TRIM(to_char(promo_end_date, 'Month')) || ' ' ||
4 TRIM(to_char(promo_end_date, 'DD, YYYY')) AS last_day
5 FROM sh.promotions
6 WHERE rownum <= 5;
PROMO_NAME LAST_DAY
------------------------------ -------------------------------------
NO PROMOTION # Friday, January 01, 9999
newspaper promotion #16-108 Tuesday, January 23, 2001
post promotion #20-232 Wednesday, November 25, 1998
newspaper promotion #16-349 Thursday, September 10, 1998
internet promotion #14-471 Sunday, March 26, 2000
5 rows selected
SQL> SELECT promo_name,
2 to_char(promo_end_date, 'fmDay') || ',' ||
3 to_char(promo_end_date, 'fmMonth') || ' ' ||
4 to_char(promo_end_date, 'fmDD, YYYY') AS last_day
5 FROM sh.promotions
6 WHERE rownum <= 5;
PROMO_NAME LAST_DAY
------------------------------ ------------------------------------
NO PROMOTION # Friday,January 1, 9999
newspaper promotion #16-108 Tuesday,January 23, 2001
post promotion #20-232 Wednesday,November 25, 1998
newspaper promotion #16-349 Thursday,September 10, 1998
internet promotion #14-471 Sunday,March 26, 2000
5 rows selected
Answer: CD