View the Exhibit 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;
TO_CHAR(promo_end_date,’fmDD, YYYY’) should return :
Friday , January 1, 1999
and not
Friday , January 01, 1999
as in the Exhibit (so exhibit must be wrong)
TO_CHAR(promo_end_date,’fmDD, YYYY’) should return :
1, 1999
and not
01, 1999
as in last line in the Exhibit (so exhibit must be wrong)
Yes freddy, you are right.
answer should be A & B
Because
TO_CHAR(promo_end_date,’fxDD, YYYY’)
&
TO_CHAR(promo_end_date,’DD, YYYY’)
should return:
01, 1999
Only Option C seems to be correct as in option D date output will be reported wrongly.
In case of fmMonth & fmDD, 1st January will be shown as January 1, not as January 01 as required output.
Only D is wrong. A,B and C will all return the correct result.
All the query are wrong without || operator
A,B return the same output day(blank), but not the same in output
C. correct day,
D. incorrect 1 for first day not 01
(According with Sagar)