sql中datetime日期类型字段比较(mysqloracle)
生活随笔
收集整理的這篇文章主要介紹了
sql中datetime日期类型字段比较(mysqloracle)
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
mysql
可以直接用大于號,也可以用? between? and
SELECT * FROM users WHERE UPDATE_DATE >= '2021-08-12 11:22:09' AND UPDATE_DATE <= '2021-08-15 11:22:33';SELECT * FROM users WHERE UPDATE_DATE BETWEEN '2021-08-12 11:22:09' AND '2021-08-15 11:22:33';Oracle
oracle sql日期比較:
在今天之前:
select * from up_date where update < to_date('2021-09-07 00:00:00','yyyy-mm-dd hh24:mi:ss') select * from up_date where update <= to_date('2021-09-07 00:00:00','yyyy-mm-dd hh24:mi:ss')在今天只后:
select * from up_date where update > to_date('2022-09-07 00:00:00','yyyy-mm-dd hh24:mi:ss') select * from up_date where update >= to_date('2022-09-07 00:00:00','yyyy-mm-dd hh24:mi:ss')精確時間:
select * from up_date where update = to_date('2022-09-07 00:00:00','yyyy-mm-dd hh24:mi:ss') 在某段時間內(nèi): select * from up_date where update between to_date('2022-07-07 00:00:00','yyyy-mm-dd hh24:mi:ss') and to_date('2022-09-07 00:00:00','yyyy-mm-dd hh24:mi:ss') select * from up_date where update < to_date('2022-09-07 00:00:00','yyyy-mm-dd hh24:mi:ss') and update > to_date('2022-07-07 00:00:00','yyyy-mm-dd hh24:mi:ss') select * from up_date where update <= to_date('2022-09-07 00:00:00','yyyy-mm-dd hh24:mi:ss') and update >= to_date('2022-07-07 00:00:00','yyyy-mm-dd hh24:mi:ss')總結(jié)
以上是生活随笔為你收集整理的sql中datetime日期类型字段比较(mysqloracle)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: mysql存储图片_Python
- 下一篇: 云数据库RDS_MySQL购买流程_以及