MySQL Decimal, numeric data type introduction
DECIMAL (M, D)
Example: Salary DECIMAL (5,2)
In This example, 5 (precision (precision)) represents the number of important decimal digits, and 2 (scale) represents the number of digits after the decimal point. In this case, therefore, the salary column can store a range of values from 999.99 to 999.99. (that is, m represents the total number of digits, and D represents the number of digits after the decimal point);
An error occurs when the inserted value exceeds the range of the stored value: (for example, when assigning 1000.03 to salary)
Out of range value for column ' salary ' at row 1
A warning is reported when the inserted value is greater than D after the decimal point: (for example, when assigning 99.8888 to salary)
Data truncated for column ' salary ' at row 1
Numeric (m,d) is the same as decimal (M, D).
MySQL decimal, numeric data type introduction