mysql> select * from table1;
+----------+------------+-----+---------------------+
| name_new | transactor | pid | order_date |
+----------+------------+-----+---------------------+
| 1hahha | 1xiaohong | | -- :: |
| 2hahha | 2xiaohong | | -- :: |
| 3hahha | 3xiaohong | | -- :: |
| 4hahha | 4xiaohong | | -- :: |
| 3hahha | bob | | -- :: |
| 3hahha | lee | | -- :: |
+----------+------------+-----+---------------------+
rows in set (0.01 sec) mysql> select * from table1 where minute(order_date)=;
+----------+------------+-----+---------------------+
| name_new | transactor | pid | order_date |
+----------+------------+-----+---------------------+
| 3hahha | 3xiaohong | | -- :: |
| 4hahha | 4xiaohong | | -- :: |
| 3hahha | bob | | -- :: |
| 3hahha | lee | | -- :: |
+----------+------------+-----+---------------------+
rows in set (0.00 sec) mysql> select * from table1 where second(order_date) between and ;
+----------+------------+-----+---------------------+
| name_new | transactor | pid | order_date |
+----------+------------+-----+---------------------+
| 3hahha | 3xiaohong | | -- :: |
| 4hahha | 4xiaohong | | -- :: |
| 3hahha | bob | | -- :: |
| 3hahha | lee | | -- :: |
+----------+------------+-----+---------------------+
rows in set (0.00 sec) mysql> select * from table1 where second(order_date) between and ;
+----------+------------+-----+---------------------+
| name_new | transactor | pid | order_date |
+----------+------------+-----+---------------------+
| 3hahha | 3xiaohong | | -- :: |
| 4hahha | 4xiaohong | | -- :: |
| 3hahha | bob | | -- :: |
+----------+------------+-----+---------------------+
rows in set (0.00 sec)
mysql> select * from table1;
+----------+------------+-----+---------------------+
| name_new | transactor | pid | order_date |
+----------+------------+-----+---------------------+
| 1hahha | 1xiaohong | | -- :: |
| 2hahha | 2xiaohong | | -- :: |
| 3hahha | 3xiaohong | | -- :: |
| 4hahha | 4xiaohong | | -- :: |
| 3hahha | bob | | -- :: |
| 3hahha | lee | | -- :: |
+----------+------------+-----+---------------------+
rows in set (0.01 sec) mysql> select * from table1 where date(order_date)='2019-08-04';
+----------+------------+-----+---------------------+
| name_new | transactor | pid | order_date |
+----------+------------+-----+---------------------+
| 1hahha | 1xiaohong | | -- :: |
| 2hahha | 2xiaohong | | -- :: |
| 3hahha | 3xiaohong | | -- :: |
| 4hahha | 4xiaohong | | -- :: |
| 3hahha | bob | | -- :: |
| 3hahha | lee | | -- :: |
+----------+------------+-----+---------------------+
rows in set (0.00 sec) mysql> select * from table1 where date(order_date) between '2019-08-04' and '2019-08-04';
+----------+------------+-----+---------------------+
| name_new | transactor | pid | order_date |
+----------+------------+-----+---------------------+
| 1hahha | 1xiaohong | | -- :: |
| 2hahha | 2xiaohong | | -- :: |
| 3hahha | 3xiaohong | | -- :: |
| 4hahha | 4xiaohong | | -- :: |
| 3hahha | bob | | -- :: |
| 3hahha | lee | | -- :: |
+----------+------------+-----+---------------------+
rows in set (0.00 sec) mysql> select * from table1 where order_date between '2019-08-04 20:45:47' and '2019-08-04 20:46:08';
+----------+------------+-----+---------------------+
| name_new | transactor | pid | order_date |
+----------+------------+-----+---------------------+
| 1hahha | 1xiaohong | | -- :: |
| 2hahha | 2xiaohong | | -- :: |
| 3hahha | 3xiaohong | | -- :: |
| 4hahha | 4xiaohong | | -- :: |
| 3hahha | bob | | -- :: |
+----------+------------+-----+---------------------+
rows in set (0.00 sec) mysql> select * from table1 where time(order_date) between '20:45:47' and '20:46:08';
+----------+------------+-----+---------------------+
| name_new | transactor | pid | order_date |
+----------+------------+-----+---------------------+
| 1hahha | 1xiaohong | | -- :: |
| 2hahha | 2xiaohong | | -- :: |
| 3hahha | 3xiaohong | | -- :: |
| 4hahha | 4xiaohong | | -- :: |
| 3hahha | bob | | -- :: |
+----------+------------+-----+---------------------+
rows in set (0.00 sec) mysql> select * from table1 where time(order_date)='20:46:02';
+----------+------------+-----+---------------------+
| name_new | transactor | pid | order_date |
+----------+------------+-----+---------------------+
| 3hahha | 3xiaohong | | -- :: |
+----------+------------+-----+---------------------+
row in set (0.00 sec)
mysql> select * from table1 where time(order_date) between "20:45:47" and "20:46:08";
+----------+------------+-----+---------------------+
| name_new | transactor | pid | order_date |
+----------+------------+-----+---------------------+
| 1hahha | 1xiaohong | | -- :: |
| 2hahha | 2xiaohong | | -- :: |
| 3hahha | 3xiaohong | | -- :: |
| 4hahha | 4xiaohong | | -- :: |
| 3hahha | bob | | -- :: |
+----------+------------+-----+---------------------+
rows in set (0.00 sec)

mysql 根据日期时间查询数据的更多相关文章

  1. mysql 根据日期进行查询数据,没有数据也要显示空

    写这篇博客主要是记录自己在对订单进行按日期查询时使用的一种查询的方法,这里的orders是订单表,你也可以改成别的什么表对于最终数据不会造成影响,除非你那个表的数据只有几条那样就会出现查不到日期的情况 ...

  2. MySql 按日期条件查询数据

    本周内: select * from wap_content where week(created_at) = week(now) 查询一天: select * from table where to ...

  3. 在数据库中(Oracle),根据时间查询数据: to_date()和to_char()函数

    1. to_date() 函数 1.1 格式 to_date("要转换的字符串","转换的格式")   //两个参数的格式必须匹配,否则会报错.即按照第二个参数 ...

  4. MySQL数据类型--日期时间

    一.博客前言 自接触学习MySQL已有一段时间了,对于MySQL的基础知识还是略懂略懂的.在这一路学习过来,每次不管看书还是网上看的资料,对于MySQL数据类型中的时间日期类型总是一扫而过,不曾停下来 ...

  5. MySQL 按照日期格式查询带有时间戳数据

    按照日期格式查询带有时间戳数据一般在MSQL数据库中的时间都是以时间戳的格式来存储时间的,但是对于我们来说,时间戳格式具体表示的是什么时间,我们很难一眼看出来,所以当我们要具体查询某一个时间或时间段的 ...

  6. MySQL之日期时间类型

    mysql(5.5)所支持的日期时间类型有:DATETIME. TIMESTAMP.DATE.TIME.YEAR. 几种类型比较如下: 日期时间类型 占用空间 日期格式 最小值 最大值 零值表示  D ...

  7. MySQL常用日期时间函数

    日期和时间函数: MySQL服务器中的三种时区设置: ①系统时区---保存在系统变量system_time_zone ②服务器时区---保存在全局系统变量global.time_zone ③每个客户端 ...

  8. MySQL之日期时间函数

      1.NOW() 用法:显示当前日期和时间 举例: mysql> select NOW(); +---------------------+ | NOW() | +-------------- ...

  9. 4、MySQL 申明变量给查询数据编号

    摘自: https://www.cnblogs.com/qixuejia/archive/2010/12/21/1913203.html https://blog.csdn.net/arbben/ar ...

随机推荐

  1. 1.Tomcat组件梳理—Bootstrap启动器

    Tomcat组件梳理-Bootstrap启动器 一开始是直接从Server开始做梳理的,但是发现有很多东西是从Catalina传输过来的,Catalina又是从Bootstrap启动的,所以还是回过头 ...

  2. tac命令以及各种linux文件查看命令

    有许多命令都可以查看文件,不同的命令有不同的优点,可以针对不同的需要分别选择命令以提高效率:    cat     由第一行开始显示内容,并将所有内容输出    tac     从最后一行倒序显示内容 ...

  3. Kubectl Rollout 回滚及Autoscale自动扩容

    Kubectl Rollout 回滚及Autoscale自动扩容 Kubernetes 中采用ReplicaSet(简称RS)来管理Pod.如果当前集群中的Pod实例数少于目标值,RS 会拉起新的Po ...

  4. 关于header file、static、inline、variable hides的一点感想

    前言 先看一段代码 #ifndef _INLINE_H #define _INLINE_H template<typename T> static inline T my_max(T a, ...

  5. centos7 ipython安装

    ##下载yum源(Centos 7 为例)[root@localhost ~]# wget http://mirror.centos.org/centos/7/extras/x86_64/Packag ...

  6. 接口测试 dubbo 接口测试技术

    本文转自测试之家 https://testerhome.com/topics/10481 dubbo是阿里巴巴开源的一套rpc方案,以为理念很契合微服务,这几年很火,用户里面不凡京东,当当,去哪儿等大 ...

  7. 使用laravel jwt-auth post提交数据一直出现 'error' => 'invalid_credentials'

    注意,laravel 对密码使用Hash加密,检查一下数据库user表中的password有没有Hash加密过 没仔细看文档坑死我了

  8. 《exception》第九次团队作业:Beta冲刺与验收准备(大结局)

    一.项目基本介绍 项目 内容 这个作业属于哪个课程 任课教师博客主页链接 这个作业的要求在哪里 作业链接地址 团队名称 Exception 作业学习目标 1.掌握软件黑盒测试技术:2.学会编制软件项目 ...

  9. 接口测试-Java代码实现接口请求并封装

    前言:在接口测试和Java开发中对接口请求方法进行封装都非常有必要,无论是在我们接口测试的时候还是在开发自测,以及调用某些第三方接口时,都能为我们调用和调试接口提供便捷: Java实现对http请求的 ...

  10. createTextRange 创建文本对象

    document.body.createTextRange 主要是用来对一些文本对象进行操作.比如你有一大段文字,都在同一个P标签内,但是你只希望通过JS改变其中的一小部分,这时就可以用createT ...