1.float, double, decimal
float: Floating point type, 4 bytes, 32bit.
Double: two-precision, 8-byte, 64-bit
Decimal: Digital type, 128bit, no loss of precision, commonly used in bank account calculation. (28 significant digits)
2.decimal Instructions for use:
Decimal (A, B)
Parameter description
A specifies the maximum number of decimal digits that can be stored to the left and right of the specified decimal point, with a maximum precision of 38.
b Specifies the maximum number of decimal digits that can be stored to the right of the decimal point. The number of decimal digits must be a value from 0 to a. The default number of decimal digits is 0.
Note
The decimal data type is used in calculations that require very high precision, and these types allow the precision and counting methods of the specified numeric values as selection parameters. Precision here is the total number of valid digits saved for this value, and the Count method represents the number of digits after the decimal point. For example, the statement decimal (5,2) specifies that the stored value will not exceed 5 digits, and that there are 2 digits after the decimal point.
Another: float and double do arithmetic operations, the value overflow will not error, the accuracy will therefore have a loss. Decimal will directly error.
Money can be a more general representation of the amount, for convenience store commodities this is usually fixed to 2 digits after the decimal point, you can use decimal.
"MySQL" Decimal data type