返回结果为[1]的是那一项?
A.SELECT MONTHS_BETWEEN (DATE '2012-01-16', DATE '2011-12-16') FROM dual;
B.SELECT MONTHS_BETWEEN (DATE '2011-12-16', DATE '2012-01-16') FROM dual;
C.SELECT MONTHS_BETWEEN (DATE '2012-02-28', DATE '2012-01-31') FROM dual;
D.SELECT MONTHS_BETWEEN (DATE '2012-05-15', DATE '2012-04-16') + 1/31 FROM dual;
B.SELECT MONTHS_BETWEEN (DATE '2011-12-16', DATE '2012-01-16') FROM dual;
C.SELECT MONTHS_BETWEEN (DATE '2012-02-28', DATE '2012-01-31') FROM dual;
D.SELECT MONTHS_BETWEEN (DATE '2012-05-15', DATE '2012-04-16') + 1/31 FROM dual;
结果为:AD
备注:
MONTHS_BETWEEN returns number of months between two dates, and is called as follows:
MONTHS_BETWEEN (date1, date2)
1.If date1 is later than date2, then the result is positive. If date1 is earlier than date2, then the result is negative.
2.If date1 and date2 are either the same days of the month or both last days of months, then the result is always an integer. Option C,because 2012 is a leap year, so February has 29 days.
3.Otherwise Oracle Database calculates the fractional portion of the result based on a 31-day month and considers the difference in time components of date1 and date2.
MONTHS_BETWEEN (date1, date2)
1.If date1 is later than date2, then the result is positive. If date1 is earlier than date2, then the result is negative.
2.If date1 and date2 are either the same days of the month or both last days of months, then the result is always an integer. Option C,because 2012 is a leap year, so February has 29 days.
3.Otherwise Oracle Database calculates the fractional portion of the result based on a 31-day month and considers the difference in time components of date1 and date2.