首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >专栏 >​mysql 日期型字段性能 datetime < timestamp < int

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

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

mysql UNIX_TIMESTAMP FROM_UNIXTIME 了解一下

代码语言:txt
复制
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'
代码语言:txt
复制
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 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档