oracle sql 函数

(7)查询日期之间的数据 
例如查询student表中出生日期(birthday)在’2016-01-01’ 和’2017-01-01’之间的数据:

select * from student where birthday between '2016-01-01' and '2017-01-01';   

对于日期不规则的数据需要先转格式,如下:

select * from student where to_date(student.birthday,'YYYY-MM-DD') between to_date('2016/01/01','YYYY-MM-DD')  and to_date('2017/01/01','YYYY-MM-DD');

(8)查询小于或者大于某日期的数据 
例如查询student表中出生日期(birthday)小于等于’2016-01-01’的数据:

select * from student where birthday <='2007-1-13';

对于日期不规则的数据需要先转格式,如下:

select * from student where to_date(student.birthday,'YYYY-MM-DD') <= to_date('2016/01/01','YYYY-MM-DD');
原文地址:https://www.cnblogs.com/lzh_527/p/8520210.html