Sql SYSDATE的时间括号
我需要选择时间戳介于现在和过去5分钟之间的行。我该怎么做?诸如此类:Sql SYSDATE的时间括号,sql,oracle,between,Sql,Oracle,Between,我需要选择时间戳介于现在和过去5分钟之间的行。我该怎么做?诸如此类: select * from tableName where timestamp between sysdate and up to -5 min 越简单越好 select * from tableName where timestamp between sysdate and sysdate - interval '5' minute 或旧式: select * from tableName where tim
select * from tableName where timestamp between sysdate and up to -5 min
越简单越好
select *
from tableName
where timestamp between sysdate and sysdate - interval '5' minute
或旧式:
select *
from tableName
where timestamp between sysdate and sysdate - 5 * 60 / 86400
SQL> select to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') NOW
, to_char(sysdate - 1/24/12,'yyyy-mm-dd hh24:mi:ss') "5 min. before"
from dual;
NOW 5 min. before
------------------- -------------------
2011-09-15 15:11:06 2011-09-15 15:06:06