博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
mysql创建表的时候指定数据类型 括号里面数字代表的含义
阅读量:4033 次
发布时间:2019-05-24

本文共 639 字,大约阅读时间需要 2 分钟。

M indicates the maximum display width for integer types. For floating-point and fixed-point types, M is the total number of digits that can be stored (the precision). For string types, M is the maximum length. The maximum permissible value of M depends on the data type.

这段解释来自http://dev.mysql.com/doc/refman/5.6/en/data-types.html

对于整数类型 括号里面的值不影响类型实际可以存储的范围,只是代表显示宽度,当实际内容不到这个宽度的时候在前面用0填充(只有在创建表的时候使用了ZEROFILL才有这个效果)

也就是说 

int(4)  int(6)  int(8) 不会影响它的可存储范围  ,它还是-2147483648-2147483647 ,它还是占用4个字节,只是如果在创建表的时候指定这一列用ZEROFILL修饰了,那么取回值得时候如果不够这里指定的位数,会在前面填0

reference:

https://alexander.kirk.at/2007/08/24/what-does-size-in-intsize-of-mysql-mean/

转载地址:http://iqfdi.baihongyu.com/

你可能感兴趣的文章
iOS 序列化与反序列化(runtime) 01
查看>>
iOS AFN 3.0版本前后区别 01
查看>>
iOS ASI和AFN有什么区别
查看>>
iOS QQ侧滑菜单(高仿)
查看>>
iOS 扫一扫功能开发
查看>>
iOS app之间的跳转以及传参数
查看>>
iOS __block和__weak的区别
查看>>
Android(三)数据存储之XML解析技术
查看>>
Spring JTA应用之JOTM配置
查看>>
spring JdbcTemplate 的若干问题
查看>>
Servlet和JSP的线程安全问题
查看>>
GBK编码下jQuery Ajax中文乱码终极暴力解决方案
查看>>
Oracle 物化视图
查看>>
PHP那点小事--三元运算符
查看>>
解决国内NPM安装依赖速度慢问题
查看>>
Brackets安装及常用插件安装
查看>>
Centos 7(Linux)环境下安装PHP(编译添加)相应动态扩展模块so(以openssl.so为例)
查看>>
fastcgi_param 详解
查看>>
Nginx配置文件(nginx.conf)配置详解
查看>>
标记一下
查看>>