Skip to main contentSkip to solution

Find the output of the following SQL statement:

SELECT DAY('2010-03-03')+MONTH('2011-04-05')+YEAR('2012-06-09');

Solution

✅ Correct Option: 2

DAY(), MONTH() and YEAR() each return a number, and the ++ operator adds those numbers instead of joining them as text.

DAY(’2010-03-03’)=3\text{DAY('2010-03-03')} = 3

MONTH(’2011-04-05’)=4\text{MONTH('2011-04-05')} = 4

YEAR(’2012-06-09’)=2012\text{YEAR('2012-06-09')} = 2012

3+4+2012=20193 + 4 + 2012 = \boxed{2019}

Keyboard Shortcuts

  • Left arrow: Previous question
  • Right arrow: Next question
  • S key: Jump to solution
  • Q key: Jump to question