Which two SQL statements would give the required output?

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

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

A.
SELECT SYSDATE – ’01-JAN-2007′ FROM DUAL:

B.
SELECT SYSDATE – TOJDATE(X)1/JANUARY/2007″) FROM DUAL:

C.
SELECT SYSDATE – TOJDATE(’01-JANUARY-2007′) FROM DUAL:

D.
SELECT TO_CHAR(SYSDATE. ‘DD-MON-YYYY’) – ’01-JAN-2007′ FROM DUAL:

E.
SELECT TO_DATE(SYSDATE. *DD/MONTH/YYYY’) – ’01/JANUARY/2007′ FROM DUAL:



Leave a Reply 3

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


AT

AT

B. SELECT SYSDATE – TO_DATE(’01/JANUARY/2007′) FROM DUAL;
C. SELECT SYSDATE – TO_DATE(’01-JANUARY-2007′) FROM DUAL;

Z.Youssef

Z.Youssef

alter session set nls_date_languAge=’ENGLISH’;
alter session set nls_date_format=’dd-month-yyyy’;

select sysdate – to_date(’01/JANUARY/2007′) from dual;
select sysdate – to_date(’01-JANUARY-2007′) from dual;

B,C

Hola

Hola

It’s B & C, other ones don’t have the same data type