Which query gives the correct output? Examine the data in the PROMO_BEGIN_DATE column of the promotions table: You want to display the number of promotions started in 1999 and 2000.Which query gives the correct output? Examine the data in the PROMO_BEGIN_DATE column of the promotions table: You want to display the number of promotions started in 1999 and 2000.Which query gives the correct output? A.Option A B.Option B C.Option C D.Option D Explanation: Show Hint ← Previous question Next question →
farhan why A and why not D? Reply dames Not D because SUBSTR(to_char(promo_begin_date,’yyyy’), 8) is NULL Reply Leandro Yep: TO_CHAR(’04-JAN-00′,’YYYY’,) = 2000 (this conversion gets only the 4 digits year) and SUBSTR(‘2000’,8) = NULL (the year from the previous instruction is 4 positions long. Substring starting in th 8th position gets nothing) Reply Michal Not only that but count(…) is the problem too. Reply
dames Not D because SUBSTR(to_char(promo_begin_date,’yyyy’), 8) is NULL Reply Leandro Yep: TO_CHAR(’04-JAN-00′,’YYYY’,) = 2000 (this conversion gets only the 4 digits year) and SUBSTR(‘2000’,8) = NULL (the year from the previous instruction is 4 positions long. Substring starting in th 8th position gets nothing) Reply Michal Not only that but count(…) is the problem too. Reply
Leandro Yep: TO_CHAR(’04-JAN-00′,’YYYY’,) = 2000 (this conversion gets only the 4 digits year) and SUBSTR(‘2000’,8) = NULL (the year from the previous instruction is 4 positions long. Substring starting in th 8th position gets nothing) Reply
why A and why not D?
Not D because SUBSTR(to_char(promo_begin_date,’yyyy’), 8) is NULL
Yep:
TO_CHAR(’04-JAN-00′,’YYYY’,) = 2000 (this conversion gets only the 4 digits year)
and
SUBSTR(‘2000’,8) = NULL (the year from the previous instruction is 4 positions long. Substring starting in th 8th position gets nothing)
Not only that but count(…) is the problem too.
A