Possible Duplicate:
MySql: Tinyint (2) vs tinyint(1) - Which difference?可能的重复:MySql: Tinyint(2)和Tinyint(1) -有什么区别?
What is the difference between:
两者的区别是什么?
TinyINT(1)
- 非常小的整数(1)
TinyINT(2)
- 非常小的整数(2)
TinyINT(3)
- 非常小的整数(3)
TinyINT(4)
- 非常小的整数(4)
3 个解决方案
#1
49
TinyINT(M) always has a range from -128..+127 signed or 0..255 unsigned. M is the display width.
TinyINT(M)的取值范围总是在-128。+ 127签名或者0 . .255无符号。M是显示宽度。
M indicates the maximum display width for integer types. The maximum display width is 255. Display width is unrelated to the range of values a type can contain, as described in Section 11.2, “Numeric Types”. For floating-point and fixed-point types, M is the total number of digits that can be stored.
M表示整数类型的最大显示宽度。最大显示宽度为255。显示宽度与类型可以包含的值范围无关,如第11.2节“数字类型”所述。对于浮点类型和定点类型,M是可以存储的数字总数。
from http://dev.mysql.com/doc/refman/5.5/en/numeric-type-overview.html
从http://dev.mysql.com/doc/refman/5.5/en/numeric-type-overview.html
#2
5
TinyINT = -128...+127
非常小的整数= -128 + 127
(n) is for display purposes.
(n)用于显示目的。
#3
5
According to Mysql manual all decimal numeric types supports syntax:
根据Mysql手册,所有十进制数字类型都支持语法:
Integer Types (Exact Value)
When using DECIMAL
it allows you to specify precision.
当使用DECIMAL时,它允许您指定精度。
With *INT
types it's has mainly display function which also specifies how many places should be added when using ZEROFILL
.
对于*INT类型,它的主要是显示函数,它还指定使用ZEROFILL时应该添加多少位置。
The byte size remains unaffected (1B
for TINYINT
).
字节大小未受影响(TINYINT为1B)。
#1
49
TinyINT(M) always has a range from -128..+127 signed or 0..255 unsigned. M is the display width.
TinyINT(M)的取值范围总是在-128。+ 127签名或者0 . .255无符号。M是显示宽度。
M indicates the maximum display width for integer types. The maximum display width is 255. Display width is unrelated to the range of values a type can contain, as described in Section 11.2, “Numeric Types”. For floating-point and fixed-point types, M is the total number of digits that can be stored.
M表示整数类型的最大显示宽度。最大显示宽度为255。显示宽度与类型可以包含的值范围无关,如第11.2节“数字类型”所述。对于浮点类型和定点类型,M是可以存储的数字总数。
from http://dev.mysql.com/doc/refman/5.5/en/numeric-type-overview.html
从http://dev.mysql.com/doc/refman/5.5/en/numeric-type-overview.html
#2
5
TinyINT = -128...+127
非常小的整数= -128 + 127
(n) is for display purposes.
(n)用于显示目的。
#3
5
According to Mysql manual all decimal numeric types supports syntax:
根据Mysql手册,所有十进制数字类型都支持语法:
Integer Types (Exact Value)
When using DECIMAL
it allows you to specify precision.
当使用DECIMAL时,它允许您指定精度。
With *INT
types it's has mainly display function which also specifies how many places should be added when using ZEROFILL
.
对于*INT类型,它的主要是显示函数,它还指定使用ZEROFILL时应该添加多少位置。
The byte size remains unaffected (1B
for TINYINT
).
字节大小未受影响(TINYINT为1B)。