zoukankan      html  css  js  c++  java
  • mysql timestamp 函数

    <pre name="code" class="sql">TIMESTAMP列的显示格式与DATETIME列相同。换句话说,显示宽度固定在19字符,并且格式为YYYY-MM-DD HH:MM:SS。
    
    
    select userNick,lastLoginTime from Client   where lastLoginTime>timestamp'2015-06-14 00:00:00' order by 2 desc
    
    
    相当于oracle 的timestamp数据类型
    
    mysql> insert into a2 values(1,'2015-06-11,00:00:00');
    Query OK, 1 row affected (0.04 sec)
    
    mysql> commit;
    Query OK, 0 rows affected (0.00 sec)
    
    mysql>  insert into a2 values(2,'2015-06-12,00:00:00');
    Query OK, 1 row affected (0.00 sec)
    
    mysql>   insert into a2 values(2,'2015-06-12,01:00:00');
    Query OK, 1 row affected (0.00 sec)
    
    mysql> commit;
    Query OK, 0 rows affected (0.14 sec)
    
    mysql> select * from a2;
    +------+---------------------+
    | id   | logintime           |
    +------+---------------------+
    |    1 | 2015-06-11 00:00:00 |
    |    2 | 2015-06-12 00:00:00 |
    |    2 | 2015-06-12 01:00:00 |
    +------+---------------------+
    3 rows in set (0.00 sec)
    
    mysql>  select * from a2 where logintime >timestamp'2015-06-12 00:00:00';
    +------+---------------------+
    | id   | logintime           |
    +------+---------------------+
    |    2 | 2015-06-12 01:00:00 |
    +------+---------------------+
    1 row in set (0.00 sec)
    
    mysql>  select * from a2 where logintime >=timestamp'2015-06-12 00:00:00';
    +------+---------------------+
    | id   | logintime           |
    +------+---------------------+
    |    2 | 2015-06-12 00:00:00 |
    |    2 | 2015-06-12 01:00:00 |
    +------+---------------------+
    2 rows in set (0.00 sec)
    
    


    
                                        
    
  • 相关阅读:
    TYPE_SCROLL_INSENSITIVE is not compatible with CONCUR_UPDATABLE
    with admin option /with grant option
    通过动态SQL语句创建游标
    Vue:在vue-cli中使用Bootstrap
    Vue:$set和$delete
    Vue:如何在vue-cli中创建并引入自定义组件
    MVC教程四:Controller向View传值的几种方式
    Vue:生命周期
    Vue.js常用指令:v-model
    vue:过滤器
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13351609.html
Copyright © 2011-2022 走看看