MySQL Use
Floating-point numbers: float and double
Fixed-point number: decimal
Represents decimals
From which we know that the decimal type is the same as the double type, but the byte number of the decimal is m+2, that is, the storage space of the fixed-point number is determined by the precision
Data type (M,D) where M is the total length of the data, D is the length after the decimal point, the inclusion of float (6,2) indicates that the data length is 6, the decimal point is 2 bits, so 1234.56 matches
If the insertion value is more accurate than the actual precision, the system will automatically round up, float and double rounding will not error, and decimal will have a warning. In MySQL, fixed-point numbers are stored as strings, so their accuracy is higher than floating-point numbers. Moreover, the floating-point number will appear error, this is the floating point numbers have been a flaw, if the accuracy of the data requirements, it is best to select the number of decimal fixed point
MySQL data type 1---floating-point and fixed-point types