Possible Duplicate:
MySql: Tinyint (2) vs tinyint(1) - Which difference?
What is the difference between:
TinyINT(1)TinyINT(2)TinyINT(3)TinyINT(4)So realistically TinyInt(3) unsigned is sufficient to display the max value of 255 . Whereas TinyInt(4) is need to display -128 for instance.
The TINYINT takes 1 byte that means it has range -128 to +127 while int takes 4 bytes; it has range -2147483648 to +2147483647.
TINYINT − A very small integer that can be signed or unsigned. If signed, the allowable range is from -128 to 127. If unsigned, the allowable range is from 0 to 255. You can specify a width of up to 4 digits.
TINYINT is a very small integer. The minimum and maximum SIGNED values are -128 and 127 respectively, while for UNSIGNED values TINYINT range is from 0 to 255. TINYINT uses 1 byte per row. It is the best option when you want to save space on your disk and enhance performance.
TinyINT(M) always has a range from -128..+127 signed or 0..255 unsigned. M is the display width.
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.
from http://dev.mysql.com/doc/refman/5.5/en/numeric-type-overview.html
According to Mysql manual all decimal numeric types supports syntax:
Integer Types (Exact Value) When using DECIMAL it allows you to specify precision.
With *INT types it's has mainly display function which also specifies how many places should be added when using ZEROFILL.
The byte size remains unaffected (1B for TINYINT).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With