sql中datetime日期类型字段比较(mysql&oracle)
2023-09-14 09:04:57 时间
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')
在某段时间内:
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')
相关文章
- MySQL数据库:入门教程(mysql数据库教程)
- Oracle与MySQL: 不同之处(oracle与mysql的区别)
- MySQL数据库数据恢复之路(mysql数据库数据丢失)
- 比较:Oracle和MySQL的优缺点(oracle和mysql)
- 『数据库演进:MySQL转Oracle的挑战』(mysql转oracle)
- 限制MySQL:限制最大连接数(mysql设置连接数)
- MySQL连接Oracle:解决方案实践(mysql连接oracle)
- Oracle收购Mysql:开启新时代(oracle收购mysql)
- mysql实力比拼:Oracle 和 MySQL 的比较(oracle对比)
- 失败MySQL服务启动失败:一种挫败与痛苦(mysql服务显示启动)
- 从MySQL到Oracle:数据库迁移的步骤(mysql迁移oracle)
- 深入了解MySQL数据库隔离级别(mysql数据库隔离级别)
- 实施MySQL容易,离开Oracle不难!(oracle迁移到mysql)
- 比较:MySQL和Oracle的不同之处(mysql和oracle)
- Oracle数据迁移至MySQL:技术与实践(oracle迁移到mysql)
- MySQL游标的基本概念与用法介绍(mysql中什么是游标)
- 探究MySQL中int数据类型的最大值限制(mysql中int最大)
- MySQL迁移至Oracle的挑战与机遇(mysq迁移oracle)
- 从MySQL切换到Oracle一个简单的过渡(mysql装oracle)
- MySQL转换Oracle实现数据库跨平台迁移(hsql转换oracle)
- 如何增加Oracle数据库的AMP值(amp值oracle)
- 如何在MySQL中正确删除数据(mysql中删除数据操作)
- mysql的成功Oracle无法像MySQL那样获得成功的原因(oracle为什没有)
- MySQL启动问题,如何解决一启动就停的情况(mysql一启动就停)
- MySQL 80新升级优化性能增加功能改善安全性(mysql一8.0)