The MySQL Manual provides a review of the MySQL numeric data types, which are summarized as follows:
MySQL supports all standard SQL numeric data types. These types include strict data types: integer, smallint, decimal, numeric, and approximate numeric data types: float, real, and double precision. The keyword Int Is the synonym of integer, and DEC is the synonym of decimal.
1 byte = 8 bits). Each user can only be 0 or 1
1B = 8b
1kb = 1024b
1 MB = 1024kb
1G = 1024 MB
1 TB = 1024 GB
1 Pb = 1024 TB
Type |
Bytes |
Minimum value |
Maximum Value |
|
|
(Signed/unsigned) |
(Signed/unsigned) |
Tinyint |
1 |
-128 (-2 ^ 7) |
127 (+ 2 ^ 7) |
|
|
0 |
255 (2 ^ 8) |
Smallint |
2 |
-32768 (-2 ^ 15) |
32767 (+ 2 ^ 15) |
|
|
0 |
65535 (2 ^ 16) |
Mediumint |
3 |
-8388608 (-2 ^ 23) |
8388607 (+ 2 ^ 23) |
|
|
0 |
16777215 (2 ^ 24) |
Int |
4 |
-2147483648 (-2 ^ 31) |
2147483647 (+ 2 ^ 31) |
|
|
0 |
4294967295 (2 ^ 32) |
Bigint |
8 |
-9223372036854775808 (-2 ^ 63) |
9223372036854775807 (+ 63) |
|
|
0 |
18446744073709551615 (2 ^ 64) |
Another problem is that when defining a value type, we will specify a width value: int (5), which indicates a realistic width, however, the stored value is not only saved to five digits. This has nothing to do with the length of the value that can be saved. For example: int (5), you can actually store 12345678 without any problems.