Multiple choice technology databases

If sysdate is ‘17/10/2009’and we run the following query,what will be the Output?

  1. 01/01/10

  2. 01/10/10

  3. 17/10/10

  4. It will throw an error

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

The query uses ADD_MONTHS function which adds months to a date. Starting from '17/10/2009', ADD_MONTHS(..., 12) adds 12 months to become '17/10/2010'. The TRUNC function with no arguments truncates to the first day of the month, giving '01/10/2010' (October 1st, 2010). The correct answer is '01/10/10'.