例子:
select * from table_test
where creatdate between to_date('2009-11-1 8:47:14','yyyy-mm-dd hh24:mi:ss')
and to_date('2009-12-1 8:47:14','yyyy-mm-dd hh24:mi:ss')
推荐使用:
select * from table_test
where creatdate >= to_date('2009-11-01 8:47:14','yyyy-MM-DD')
and creatdate <= to_date('2002-03-01' ,'YYYY-MM-DD');
用between...and...的函数可能会慢些 。
本文介绍了一种在SQL中使用日期范围查询的优化方法,通过对比between...and...与大于等于及小于等于的操作符,展示了如何提高查询效率。
8982

被折叠的 条评论
为什么被折叠?



