3)当前者数大于后者,如:salary between 100 and 10;此时不会出错,但salary为50的记录也不能被取出。
4)not between..and..只是取指定范围的相反范围,也就是不在这个范围的记录,其用户可以用组个逻辑条件来取代。
SELECT MONTHS_BETWEEN (TO_DATE ('2003/01/01', 'yyyy/mm/dd'), TO_DATE ('2003/03/14', 'yyyy/mm/dd')) FROM dual;
returns -2.41935483870968
SELECT MONTHS_BETWEEN (TO_DATE ('2003/07/01', 'yyyy/mm/dd'), TO_DATE ('2003/03/14', 'yyyy/mm/dd')) FROM dual;
returns 3.58064516129032
下面查找月份
MONTHS_BETWEEN(
SELECT MONTHS_BETWEEN(SYSDATE+365, SYSDATE-365) FROM dual;
SELECT MONTHS_BETWEEN(SYSDATE-365, SYSDATE+365) FROM dual;