MySQL set a numeric column, you need to take into account the range of values, so the value of the type must be considered, the following is the MySQL numeric type of storage length, of course, storage length is basically determined by its range. This article extracts from the MySQL official website, only does the summary summary collation.
First, TINYINT
1 byte storage, range Signed-128-127, unsigned 0-255. There is also a type of bool, equivalent to tinyint (1).
Second, SMALLINT
2 byte storage, with a range of symbols ranging from 32768 to 32767. The unsigned range is 0 to 65535.
Third, Mediumint
3 byte storage, with a range of symbols ranging from 8388608 to 8388607. The unsigned range is 0 to 16777215.
Four, INT, INTEGER
4 byte storage, with a range of symbols ranging from 2147483648 to 2147483647. The unsigned range is 0 to 4294967295.
Five, BIGINT
8 byte storage, with a range of symbols ranging from 9223372036854775808 to 9223372036854775807. The unsigned range is 0 to 18446744073709551615.
Six, FLOAT (p)
If 0 <= p <= 24 is 4 bytes, if <= p <= 53 is 8 bytes
Seven, FLOAT
4 bytes of storage, the range allowed values are -3.402823466E+38 to -1.175494351E-38, 0, and 1.175494351E-38 to 3.402823466E+38.
Eight, DOUBLE [PRECISION]
8 byte storage, range allows -1.7976931348623157E+308 to -2.2250738585072014E-308, 0, and 2.2250738585072014E-308 to 1.7976931348623157e+ 308.
IX, DECIMAL (M,D), NUMERIC (m,d)
Compressed "Strict" fixed-point number, variable length type. M is the total number of decimal places (precision), and D is the number of digits after the decimal point (scale). The '-' symbol for the decimal and (negative numbers) is not included in M. If D is 0, the value does not have a decimal point or fractional portion. The maximum number of digits (M) of the decimal integer is 65. The maximum number of digits supported for a decimal number (D) is 30. If D is omitted, the default is 0. If M is omitted, the default is 10. If you specify unsigned, negative values are not allowed.
Ten, BIT (M)
Approximately (M+7)/8 byte storage, M represents the number of digits per value, ranging from 1 to 64. If M is omitted, the default is 1