Does anyone know about this?
M is the total number of digits and D is the number of digits following the decimal point. If M and D are omitted, values are stored to the limits permitted by the hardware. A double-precision floating-point number is accurate to approximately 15 decimal places. DOUBLE( M , D ) is a nonstandard MySQL extension.
Range: The range of DECIMAL type is -10^38 +1 through 10^38 –1. The largest value is represented by DECIMAL(38, 0) . The most precise fractional value (between 0 and 1, or 0 and -1) is represented by DECIMAL(38, 38) , with 38 digits to the right of the decimal point.
The decimal data type is an exact numeric data type defined by its precision (total number of digits) and scale (number of digits to the right of the decimal point).
In standard SQL, the syntax DECIMAL( M ) is equivalent to DECIMAL( M ,0) . Similarly, the syntax DECIMAL is equivalent to DECIMAL( M ,0) , where the implementation is permitted to decide the value of M . MySQL supports both of these variant forms of DECIMAL syntax. The default value of M is 10.
As the docs say:
M is the maximum number of digits (the precision). It has a range of 1 to 65. (Older versions of MySQL allowed a range of 1 to 254.)
D is the number of digits to the right of the decimal point (the scale). It has a range of 0 to 30 and must be no larger than M.
So M stands for Maximum (number of digits overall), D stands for Decimals (number of digits to the right of the decimal point).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With