前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >​mysql 日期型字段性能 datetime < timestamp < int

​mysql 日期型字段性能 datetime < timestamp < int

原创
作者头像
Cabber
修改2018-07-26 15:17:04
1.8K0
修改2018-07-26 15:17:04
举报
文章被收录于专栏:nodejs后端nodejs后端
  • datetime date time
  • timestamp 视觉上与datetime一样
  • int 存的是时间缀 视觉不明显,好比较

mysql UNIX_TIMESTAMP FROM_UNIXTIME 了解一下

select * from wap_login where UNIX_TIMESTAMP(creat_date) between UNIX_TIMESTAMP('2018-07-26 00:00:00') and UNIX_TIMESTAMP('2018-07-26 23:59:59')

select * from wap_login where creat_date between '2018-07-26 00:00:00' and '2018-07-26 23:59:59'
select * from wap_login where creat_date between UNIX_TIMESTAMP('2018-07-01 00:00:00') and UNIX_TIMESTAMP('2018-07-26 23:59:59')

select * from wap_login where creat_date < '2018-07-01 00:00:00'

select * from wap_login where UNIX_TIMESTAMP(creat_date) between UNIX_TIMESTAMP('2018-07-26 00:00:00') and UNIX_TIMESTAMP('2018-07-26 23:59:59')

select * from wap_login where creat_date between '2018-07-26 00:00:00' and '2018-07-26 23:59:59'

select * from wap_login where UNIX_TIMESTAMP(creat_date) < 1530374400 

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
相关产品与服务
云数据库 SQL Server
腾讯云数据库 SQL Server (TencentDB for SQL Server)是业界最常用的商用数据库之一,对基于 Windows 架构的应用程序具有完美的支持。TencentDB for SQL Server 拥有微软正版授权,可持续为用户提供最新的功能,避免未授权使用软件的风险。具有即开即用、稳定可靠、安全运行、弹性扩缩等特点。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档