MySQL Numeric Types(数字类型)

Integer

Type Storage (Bytes) Minimum Value Signed Minimum Value Unsigned Maximum Value Signed Maximum Value Unsigned
TINYINT 1 -128 0 127 255
SMALLINT 2 -32768 0 32767 65535
MEDIUMINT 3 -8388608 0 8388607 16777215
INT 4 -2147483648 0 2147483647 4294967295
BIGINT 8 -263 0 2^63-1 2^64-1

Decimal

salary DECIMAL(5,2)

Float&Double

FLOAT(7,4) will look like -999.9999 when displayed.
MySQL performs rounding when storing values, so if you insert 999.00009 into a FLOAT(7,4) column, the approximate result is 999.0001.

Bit

If you assign a value to a BIT(M) column that is less than M bits long, the value is padded on the left with zeros. For example, assigning a value of b’101’ to a BIT(6) column is, in effect, the same as assigning b’000101’.

参考:
https://dev.mysql.com/doc/refman/8.0/en/numeric-types.html

你可能感兴趣的:(mysql,mysql)