当前位置:网站首页>timestamp列使用varchar类型和使用date类型有什么区别?
timestamp列使用varchar类型和使用date类型有什么区别?
2022-07-27 03:57:00 【赵勇】
timestamp列使用varchar类型和使用date类型有什么区别
其他答案1:
1、底层处理逻辑不同,一个是字符,一个是日期。日期类型可以自动过滤掉非法日期,比如12月32日。
2、用字符表示日期和时间,至少需要14个字符(yyyymmddhhmiss),而data类型只要7个字符。
3、使用date类型很方便进行日期上面的计算,比如算间隔天数,加减日期值等。DATE类型还支持丰富的转换和处理函数,可以从中提取相应的信息或进行转换。
4、date用做分区键时,还能使用自动间隔分区,而字符不可以。
总之,原则上,存的数据是什么,就用对应的数据类型。
边栏推荐
- 【软件工程期末复习】知识点+大题详解(E-R图、数据流图、N-S盒图、状态图、活动图、用例图....)
- 微服务的feign调用header头被丢弃两种解决方案(附源码)
- 第二轮Okaleido Tiger即将登录Binance NFT,或持续创造销售神绩
- The data in echart histogram is displayed at the top of the chart
- Sed output specified line
- ros 相机标定 sensor_msgs/CameraInfo Message 数据类型及含义
- JMeter download and installation
- Five basic data structures of redis
- 数据分析师岗位分析
- HEAD detached from origin/...导致push失败
猜你喜欢

The data in echart histogram is displayed at the top of the chart

Navicat将MySQL导出表结构以及字段说明
![[competition reference] pytorch common code snippet and operation collection](/img/b3/0b91e381e2444dfd222537bf5b8ccf.jpg)
[competition reference] pytorch common code snippet and operation collection

一张图看懂KingbaseES V9

The difference between ArrayList and LinkedList

Ant JD Sina 10 architects 424 page masterpiece in-depth distributed cache from principle to practice pdf

使用kubesphere图形界面dashboard开启devops功能

Head detached from origin/... Causes push failure

第二轮Okaleido Tiger即将登录Binance NFT,或持续创造销售神绩

BSN IPFS(星际文件系统)专网简介、功能、架构及特性、接入说明
随机推荐
People don't talk much, engineers don't talk much
无有线网络下安装并配置debian
通信协议综述
Is the e-commerce billing system important? How should the platform choose billing service providers?
spark练习案例(升级版)
Head detached from origin/... Causes push failure
Okaleido生态核心权益OKA,尽在聚变Mining模式
结构型模式-桥接模式
Learning route from junior programmer to architect + complete version of supporting learning resources
BSN IPFs (interstellar file system) private network introduction, functions, architecture and characteristics, access instructions
els_ 画矩形、代码规划和备份
The difference between ArrayList and LinkedList
Overview of communication protocols
佳明手表怎么设置用户定制显示
Ribbon负载均衡策略与配置、Ribbon的懒加载和饥饿加载
STM32 serial port based on Hal library accepts interrupts and idle interrupts
Install and configure Debian on a wired network
Eureka-服务注册中心
数据库泰斗王珊:努力创新,精心打磨优质的数据库产品
tcp协议知识详解