Oracle__6. Oracle 1Z0-051 Exam - Date Functions Flashcards
If today is July 9, 2003, what is returned from the following statement? SELECT TO_CHAR( sysdate, ‘yyyy/MM/dd’) FROM dual
2003/07/09The TO_CHAR function will have a leading space added when a format model is used for the sign (+/-)
If today is July 9, 2003, what is returned from the following statement? SELECT TO_CHAR( sysdate, ‘Month DD, YYYY’) FROM dual
July 09, 2003The TO_CHAR function will have a leading space added when a format model is used for the sign (+/-)
If today is July 9, 2003, what is returned from the following statement? SELECT TO_CHAR( sysdate, ‘FMMonth DD, YYYY’) FROM dual
July 9, 2003The FM removes leading zeros
If today is July 9, 2003, what is returned from the following statement? SELECT TO_CHAR( sysdate, ‘FMMonth DDth, yyyy’) FROM dual
July 9TH, 2003Notice July is capitalized and TH is all capital letters. The upper and lower case in format strings determines the case of the results.
If today is July 9, 2003, what is returned from the following statement? SELECT TO_CHAR( sysdate, ‘FMMON DDth, YYYY’) FROM dual
JUL 9TH, 2003Notice both JUL and TH are all capital letters. The upper and lower case in format strings determines the case of the results.
If today is July 9, 2003, what is returned from the following statement? SELECT TO_CHAR( sysdate, ‘FMMon ddth, YYYY’) FROM dual
Jul 9th, 2003Notice July is capitalized and th is all small letters. The upper and lower case in format strings determines the case of the results.
If today is Monday, what is returned from the following statement? SELECT TO_CHAR( sysdate,’DAY’) FROM Dual
MONDAYThe upper and lower case in format strings determines the case of the results.
If today is Monday, what is returned from the following statement? SELECT TO_CHAR( sysdate, ‘Day’) FROM Dual
MondayThe upper and lower case in format strings determines the case of the results.
If today is Monday, what is returned from the following statement? SELECT TO_CHAR( sysdate, ‘day’) FROM Dual
mondayThe upper and lower case in format strings determines the case of the results.
If it is 1:10 pm, what is returned from the following statement? SELECT TO_CHAR( sysdate, ‘HH:mm:ss A.M.’) FROM dual
1:10:00 P.M.Notice periods in PM because there were periods in A.M.
If it is 1:10 pm, what is returned from the following statement? SELECT TO_CHAR( sysdate, ‘HH24:mm:ss AM’) FROM dual
13:10:00 PMNotice no periods in PM because there were no periods in AM
If today is July 4, 2003, what is returned from the following statement? SELECT TO_DATE( ‘2003/07/09’, ‘yyyy/mm/dd’) FROM dual
09-Jul-99 The value returned is a date type and not a string. The default date type format is DD-Mon-RRNote: the data type format of the value must match the format. It does not care what today is.
If today is July 4, 2003, what is returned from the following statement? SELECT TO_CHAR( ‘070903’, ‘mmddyy’) FROM dual
jul0903The upper and lower case in format strings determines the case of the results. It does not care what today is.
What is returned from the following statement? SELECT LAST_DAY( ‘2003/02/03’, ‘yyyy/mm/dd’) FROM dual
28-feb-03 as a date typeThe last day of the month including leap years.The upper and lower case in format strings determines the case of the results.
What is returned from the following statement? SELECT NEXT_DAY( ‘01-AUG-03’, ‘FRIDAY’) FROM dual
returns the date of the next Friday after 1-Aug-03 as a date typeThe day values for the format include SUNDAY, MONDAY, TUESDAY, WEDNESDAY,THURSDAY, FRIDAY and SATURDAY
If today is FRIDAY, what is returned from the following statement? SELECT NEXT_DAY(sysdate, ‘FRIDAY’) FROM dual
The date value of the next Friday after today.Saturday a week after tomorrow.
What is returned from the following statement? SELECT ADD_MONTHS( ‘07-AUG-03’,3) FROM dual
07-NOV-03 as a date type
What is returned from the following statement? SELECT ADD_MONTHS( ‘05-AUG-03’,-2) FROM dual
05-JUN-03 as a date type
What is returned from the following statement? SELECT MONTHS_BETWEEN( TO_DATE( ‘2003/01/01’, ‘yyyy/mm/dd’), TO_DATE( ‘03-14-2003’, ‘mm-dd-yyyy’)) FROM dual
-2.41934if the same date is used for both parameters the result is 0
What is returned from the following statement? SELECT ROUND( ‘22-AUG-03’, ‘YEAR’) FROM dual
‘01-JAN-04’rounds to the first of the nearest year
What is returned from the following statement? SELECT ROUND( ‘22-AUG-03’, ‘MONTH’) FROM dual
‘01-SEP-03’rounds to the first of the nearest month
What is returned from the following statement? SELECT TRUNC( TO_DATE( ‘22-AUG-03’, ‘YEAR’)) FROM dual
‘01-JAN-03’Truncates to the first day of the year
What is returned from the following statement? SELECT TRUNC( ‘22-AUG-03’, ‘MONTH’) FROM dual
‘01-AUG-03’Truncates to the first day of the month
What is returned from this SQL statement if the value for hire_date is 10-JAN-00? SELECT TO_CHAR(hire_date,’yyyy’) FROM dual
2000 as a character data type
What is returned from this SQL statement if the value for hire_date is 10-JAN-00? SELECT TO_CHAR(hire_date,’rr’) FROM dual
00 as a character data type
What is returned from this SQL statement if the field value for hire_date is 01-JAN-00? SELECT TO_CHAR(hire_date,’mon dd yy’) FROM dual
jan 01 00 as a character data typeNotice lower case and leading zeros
What is returned from the following statement? SELECT trans_date, CASE TRIM(TO_CHAR(trans_date,’DAY’)) in (‘SATURDAY’,’SUNDAY’) THEN ‘Weekend’ ELSE ‘Weekday’ END ‘Day Type’ FROM transactions
“all values for the field ““Day Type”” which will have either ‘Weekday’ or ‘Weekend’ as a return for the column ““Day Type”””
What is returned from following statement? SELECT trans_date, CASE TRIM(TO_CHAR(trans_date,’DAY’)) BETWEEN ‘MONDAY’ AND ‘FRIDAY’ ‘Weekday’ ELSE ‘Weekend’ END ‘Day Type’ FROM transactions
“all values for the field ““Day Type”” will be ‘Weekend’ because no values will fall between ‘MONDAY’ and ‘FRIDAY’The first value of a BETWEEN must be the lower value.”
What is returned from following statement? SELECT trans_date, CASE TRIM(TO_CHAR(trans_date,’DAY’)) BETWEEN ‘MONDAY’ AND ‘THURSDAY’ ‘Weekday’ ELSE ‘Weekend’ END ‘Day Type’ FROM transactions
Values for days on MONDAY, TUESDAY, THURSDAY, SATURDAY and SUNDAY will be weekday while the rest will be weekend.BETWEEN does a string compare from words beginning with ‘MO’ thru ‘TH’
If today is Monday 28-OCT-98, what is returned from the following statement? SELECT NEXT_DAY(SYSDATE,’MON’) FROM dual
The next Monday after today.4-Nov-98
If today is Monday 28-OCT-98, what is returned from the following statement? SELECT LAST_DAY(SYSDATE) FROM DUAL
31-Oct-98The last day of the Month
What is the difference between the return values of the following 2 statements? SELECT TO_CHAR(‘28-OCT-2009’,’fmMonth’) FROM dual; SELECT TO_CHAR(‘28-OCT-2009’,’Month’) FROM dual;
The fmMonth will trim trailing spaces, because Month will have 2 trailing spaces.The TO_CHAR with a month has 9 character to hold the longest month name plus a trailing space
What is returned from the following statement? SELECT SYSDATE - TO_DATE(‘01-JANUARY-2007’) FROM dual
a numeric value which is the difference between the 2 dates
What is returned from the following statement? SELECT SYSDATE - TO_DATE(‘01/JANUARY/2007’) FROM dual
a numeric value which is the difference between the 2 dates
SELECT TO_CHAR(SYSDATE,’DD-MON-YYYY’) - ‘01-JAN-2007’ FROM dual
errorcannot subtract a string from a string
What date function accepts a date data type but returns a numeric value?
MONTHS_BETWEEN