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:



Leave a Reply 5

Your email address will not be published. Required fields are marked *


farhan

farhan

why A and why not D?

dames

dames

Not D because SUBSTR(to_char(promo_begin_date,’yyyy’), 8) is NULL

Leandro

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)

Michal

Michal

Not only that but count(…) is the problem too.