Introduction to MySQL decimal and numeric data types, decimalnumeric
MySQL decimal and numeric data types
DECIMAL (M, D)
Example: salary DECIMAL (5, 2)
In this example, 5 (precision) represents the number of important decimal digits, and 2 (data range (scale) represents the number of digits after the decimal point. In this case, the salary column can store values ranging from-999.99 to 999.99. (M indicates the total number of digits, and D indicates the number of digits after the decimal point );
When the inserted value exceeds the storage value range, an error is returned: (for example, if 1000.03 is assigned to salary)
Out of range value for column 'salary 'at row 1
When the number of digits after the decimal point is greater than D, a warning is reported: (for example, if 99.8888 is assigned to salary)
Data truncated for column 'salary 'at row 1
Numeric (M, D) is the same as DECIMAL (M, D.