oracle sql日期比较
oracle sql日期比较:
在今天之前:
在今天只后:
精确时间:
在某段时间内:
在今天之前:
select
*
from
up_date
where
update
<
to_date(
'
2007-09-07 00:00:00
'
,
'
yyyy-mm-dd hh24:mi:ss
'
)
select * from up_date where update <= to_date( ' 2007-09-07 00:00:00 ' , ' yyyy-mm-dd hh24:mi:ss ' )
select * from up_date where update <= to_date( ' 2007-09-07 00:00:00 ' , ' yyyy-mm-dd hh24:mi:ss ' )
在今天只后:
select
*
from
up_date
where
update
>
to_date(
'
2007-09-07 00:00:00
'
,
'
yyyy-mm-dd hh24:mi:ss
'
)
select * from up_date where update >= to_date( ' 2007-09-07 00:00:00 ' , ' yyyy-mm-dd hh24:mi:ss ' )
select * from up_date where update >= to_date( ' 2007-09-07 00:00:00 ' , ' yyyy-mm-dd hh24:mi:ss ' )
精确时间:
select
*
from
up_date
where
update
=
to_date(
'
2007-09-07 00:00:00
'
,
'
yyyy-mm-dd hh24:mi:ss
'
)
在某段时间内:
select
*
from
up_date
where
update
between
to_date(
'
2007-07-07 00:00:00
'
,
'
yyyy-mm-dd hh24:mi:ss
'
)
and
to_date(
'
2007-09-07 00:00:00
'
,
'
yyyy-mm-dd hh24:mi:ss
'
)
select * from up_date where update < to_date( ' 2007-09-07 00:00:00 ' , ' yyyy-mm-dd hh24:mi:ss ' ) and update > to_date( ' 2007-07-07 00:00:00 ' , ' yyyy-mm-dd hh24:mi:ss ' )
select * from up_date where update <= to_date( ' 2007-09-07 00:00:00 ' , ' yyyy-mm-dd hh24:mi:ss ' ) and update >= to_date( ' 2007-07-07 00:00:00 ' , ' yyyy-mm-dd hh24:mi:ss ' )
select * from up_date where update < to_date( ' 2007-09-07 00:00:00 ' , ' yyyy-mm-dd hh24:mi:ss ' ) and update > to_date( ' 2007-07-07 00:00:00 ' , ' yyyy-mm-dd hh24:mi:ss ' )
select * from up_date where update <= to_date( ' 2007-09-07 00:00:00 ' , ' yyyy-mm-dd hh24:mi:ss ' ) and update >= to_date( ' 2007-07-07 00:00:00 ' , ' yyyy-mm-dd hh24:mi:ss ' )
本文介绍了 Oracle SQL 中日期的多种操作方法,包括日期比较、获取当前系统日期时间、日期加减运算等,并提供了实际应用示例。
5185

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



