The following describes the storage capacity and range of MySQL numeric data types for your reference. If you are interested in MySQL numeric data types, take a look.
Storage required for column types
TINYINT 1 byte
SMALLINT 2 bytes
MEDIUMINT 3 bytes
INT 4 bytes
INTEGER 4 bytes
BIGINT 8 bytes
FLOAT (X) 4 if X <= 24 or 8 If 25 <= X <= 53
FLOAT 4 bytes
DOUBLE 8 bytes
Double precision 8 bytes
REAL 8 bytes
DECIMAL (M, D) M bytes (D + 2, if M <D)
NUMERIC (M, D) M bytes (D + 2, if M <D)
MySQL numeric data types can be roughly divided into two categories: one is an integer, and the other is a floating point or decimal. Many different subtypes are available for each of these classes. Each subtype supports data of different sizes. MySQL allows us to specify whether the values in the value field are positive or negative or fill with zero.
The following table lists various MySQL numeric data types and their permitted ranges and occupied memory space.
Type |
Size |
The range is signed) |
The range is unsigned) |
Purpose |
TINYINT |
1 byte |
(-128,127) |
(0,255) |
Small integer |
SMALLINT |
2 bytes |
(-32 767) |
(535) |
Large integer |
MEDIUMINT |
3 bytes |
(-8 388 388 607) |
(777 215) |
Large integer |
INT or INTEGER |
4 bytes |
(-2 147 483 147 483, 2 647) |
(294 967 295) |
Large integer |
BIGINT |
8 bytes |
(-9 233 372 036 854 775 223 372 854 775 807) |
(446 744 709 073 551 615) |
Maximum integer |
FLOAT |
4 bytes |
(-3.402 823 466 E + 38, 1.175 494 351 E-38), 0, (1.175 494 351 E-38, 3.402 823 466 351 E + 38) |
0, (1.175 494 351 E-38, 3.402 823 466 E + 38) |
Precision Floating point value |
DOUBLE |
8 bytes |
(1.797 693 134 862 315 7 E + 308, 2.225 073 858 507 201 4 E-308), 0, (2.225 073 858 507 201 4 E-308, 1.797 693 134 862 315 7 E + 308) |
0, (2.225 073 858 507 201 4 E-308, 1.797 693 134 862 7 E + 315) |
Double Precision Floating point value |
DECIMAL |
For DECIMAL (M, D), if M> D is M + 2, otherwise D + 2 |
Values dependent on M and D |
Values dependent on M and D |
Small value |
MySQL index type
How to modify the order of mysql Fields
How to add or delete a primary key in mysql
How to Set MySql access restrictions
Six Methods for changing the password of MySQL