MySQL tutorial: DECIMAL [EN]
top of page
CerebroSQL

MySQL: 

DECIMAL

DECIMAL[(M[,D])] [UNSIGNED] [ZEROFILL]

A packed "exact" fixed-point number. M is the total number of digits
(the precision) and D is the number of digits after the decimal point
(the scale). The decimal point and (for negative numbers) the - sign
are not counted in M. If D is 0, values have no decimal point or
fractional part. The maximum number of digits (M) for DECIMAL is 65.
The maximum number of supported decimals (D) is 30. If D is omitted,
the default is 0. If M is omitted, the default is 10. (There is also a
limit on how long the text of DECIMAL literals can be)

UNSIGNED, if specified, disallows negative values. As of MySQL 8.0.17,
the UNSIGNED attribute is deprecated for columns of type DECIMAL (and
any synonyms) and support for it will be removed in a future MySQL
version. Consider using a simple CHECK constraint instead for such
columns.

All basic calculations (+, -, *, /) with DECIMAL columns are done with
a precision of 65 digits.

Example

bottom of page