oracle --sql--查询日期区间的数据

两种方法

两种情况:
1:查询给定时间在开始时间列与结束时间列范围中数据;
2:查询日期列在开始时间列与结束时间列范围中数据;

第一种:<,>, <= , >=

  select * from 表名 where 日期列 >= to_date('2015-10-20 00:00:00','yyyy-mm-dd hh24:mi:ss') and t.日期列 <= to_date('2015-10-20 23:59:59','yyyy-mm-dd hh24:mi:ss')

第二种 between and

select * from 表名 where 日期列 between to_date('2015-10-20 00:00:00','yyyy-mm-dd hh24:mi:ss')and to_date('2015-10-20 23:59:59','yyyy-mm-dd hh24:mi:ss')

你可能感兴趣的:(oracle,sql,时间范围,日期范围,区间数据)