迷一样的逍遥人
晴带雨伞,包带干粮,点滴积累,水到渠成.

(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');
posted on 2018-03-07 01:19  谜一样的逍遥人  阅读(176)  评论(0编辑  收藏  举报