zoukankan      html  css  js  c++  java
  • sql日期比较

    sql 中 datetime日期类型字段比较

    mysql

    可以直接用大于号,也可以用  between  and

    SELECT * FROM staff WHERE UPDATE_DATE >= '2019-08-14 11:41:09' AND UPDATE_DATE <= '2019-08-14 11:41:11';
    
    SELECT * FROM staff WHERE UPDATE_DATE BETWEEN '2019-08-14 11:41:09' AND '2019-08-14 11:41:11';

    Oracle

    转:

    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 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')
    posted on 2007-09-07 16:29 forker 阅读(79520) 评论(6)  编辑  收藏 所属分类: database
  • 相关阅读:
    JVM(六)——垃圾回收算法
    JVM(五)——执行引擎、String
    JVM(四)——方法区
    JVM(三)——堆
    JVM(二)——虚拟机栈
    JVM(一)——概述和类加载子系统
    Java EE入门(二十二)——Linux和Nginx
    操作系统(六)——磁盘和IO
    【03】RNN
    【02】时间复杂度
  • 原文地址:https://www.cnblogs.com/libin6505/p/11398774.html
Copyright © 2011-2022 走看看