Question

Does anyone know about this?

Was it helpful?

Solution

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).

OTHER TIPS

https://dev.mysql.com/doc/refman/5.7/en/precision-math-decimal-characteristics.html

The declaration syntax for a DECIMAL column is DECIMAL(M,D). The ranges of values for the arguments in MySQL 5.1 are as follows:

  • 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.

[Note: the link above has been updated to point to the MySQL 5.7 docs, but the text was quoted from the MySQL 5.1 docs.]

The doc says:

The declaration syntax for a DECIMAL column remains DECIMAL(M,D), although the range of values for the arguments has changed somewhat:

  • M is the maximum number of digits (the precision). It has a range of 1 to 65. This introduces a possible incompatibility for older applications, because previous versions of MySQL allow a range of 1 to 254. (The precision of 65 digits actually applies as of MySQL 5.0.6. From 5.0.3 to 5.0.5, the precision is 64 digits.)

  • 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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top