nerdexam
Oracle

1Z0-061 · Question #109

You need to calculate the number of days from 1st Jan 2007 till date: Dates are stored in the default format of dd-mm-rr. Which two SQL statements would give the required output? (Choose two.)

The correct answer is A. SELECT SYSDATE - TO_DATE('01/JANUARY/2007') FROM DUAL; C. SELECT SYSDATE - TO_DATE('01-JANUARY-2007') FROM DUAL. See the full explanation below for the reasoning.

Question

You need to calculate the number of days from 1st Jan 2007 till date:

Dates are stored in the default format of dd-mm-rr. Which two SQL statements would give the required output? (Choose two.)

Options

  • ASELECT SYSDATE - TO_DATE('01/JANUARY/2007') FROM DUAL;
  • BSELECT TO_DATE(SYSDATE, 'DD/MONTH/YYYY')-'01/JANUARY/2007' FROM DUAL;
  • CSELECT SYSDATE - TO_DATE('01-JANUARY-2007') FROM DUAL
  • DSELECT SYSDATE - '01-JAN-2007' FROM DUAL
  • ESELECT TO_CHAR(SYSDATE, 'DD-MON-YYYY')-'01-JAN-2007' FROM DUAL;

How the community answered

(34 responses)
  • A
    82% (28)
  • B
    3% (1)
  • D
    6% (2)
  • E
    9% (3)

Community Discussion

No community discussion yet for this question.

Full 1Z0-061 Practice