MySQL中常用的数据类型

在写sql语句的时候,数据类型是避不可少的一个环节,以下是我在学习的过程中总结的数据类型,仅供参考:

  • 数值类型

您可以在上表中看到,每种类型都有其对应的范围。如果它大于某个值,则不能再使用原始类型。你应该注意字体的范围。

[En]

You can see in the above table that each type has its own corresponding range. If it is greater than a certain value, you can no longer use the original type. You should pay attention to the range of the type.

  • 字符串类型

字符串类型中char与varchar使用频率最高,它们的区别在于是否为定长字符串,在描述某一确定值时,比如身份证号码,在我国身份证号为18为,即使用char,比如姓名,字符长度不一,使用varchar。二进制文本现在使用频率已经大大降低,可以不做硬性要求。

  • 日期时间类型

在日期时间类型中特别注意year的范围是1901-2155,超出范围就需使用date。

数据类型非常重要,不容忽视。

[En]

Data types are very important and cannot be ignored.

Original: https://www.cnblogs.com/hxymysql/p/16063021.html
Author: 52Hz1
Title: MySQL中常用的数据类型

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/505514/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球