1.范圍日期的查詢:
select * from goods
where g_time between
to_date('2018/12/26 10:01:59','yyyy-MM-dd hh:mi:ss')
and to_date('2018/12/26 10:05:17',' yyyy-MM-dd hh:mi:ss');
2.等於某個日期的查詢:
select * from goods
where g_time=to_date('2018/12/26 10:05:17','yyyy-MM-dd hh:mi:ss');
3.當前日期的前幾天和后幾天的數據:
select * from goods
where g_time >= trunc(sysdate)-6 and < trunc(sysdate)-3;
為什么要用trunc(sysdate)呢
因為當前時間一般不會正好是0點,比如當前是11點,-6就是6天前的11 點開始
4.查詢出每個月倒數第三天上架的商品信息:
select g.* from goods g where g.g_time=last_day(g.g_time)-2;