MySQL 数据类型
整型
类型声明里面的 int(5)
代表的意思。INT is always four bytes wide.The 5 is the "display width"
What does INT(5) in mysql mean
字符
mysql 中 varchar 类型最大是多少(这是一个复杂的问题) What is the MySQL VARCHAR max size
- Keep in mind that MySQL has a maximum row size limit : The internal representation of a MySQL table has a maximum row size limit of 65,535 bytes, not counting BLOB and TEXT types. BLOB and TEXT columns only contribute 9 to 12 bytes toward the row size limit because their contents are stored separately from the rest of the row. Read more about Limits on Table Column Count and Row Size .
- Maximum size a single column can occupy, is different before and after MySQL 5.0.3 : Values in VARCHAR columns are variable-length strings. The length can be specified as a value from 0 to 255 before MySQL 5.0.3, and 0 to 65,535 in 5.0.3 and later versions. The effective maximum length of a VARCHAR in MySQL 5.0.3 and later is subject to the maximum row size (65,535 bytes(65K), which is shared among all columns) and the character set used. However, note that the limit is lower if you use a multi-byte character set like utf8 or utf8mb4: VARCHAR(21844) CHARACTER SET utf8
- Use TEXT types inorder to overcome row size limit. : The four TEXT types are TINYTEXT, TEXT, MEDIUMTEXT, and LONGTEXT. These correspond to the four BLOB types and have the same maximum lengths and storage requirements.
bool
mysql 可以在 ddl 的时候设置 bool 类型,但是 mysql 解释器会将其转译成 tinyint(1)
,也可以使用 bit
类型实现, 参考
decimal
DECIMAL(13,4)
: This means that the column will have a total size of 13 digits where 4 of these will be used for precision representation. have a max value of: 999999999.9999
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论