Programster's Blog

Tutorials focusing on Linux, programming, and open-source

MySQL Decimal

The decimal type stores an exact value, which makes it appropriate for storing currency, unlike the float and double types.

Unlike integer types, the storage requirements vary, with the value being stored within the database in binary format.


When defining a decimal, one specifies the number of digits in total (including before and after the decimal place), followed by the number of digits you wish to store after the decimal place. For example, To store a range of -999.99 to 999.99, you would use the following definition.


The maximum number of digits that can be stored is 65.


Last updated: 25th January 2021
First published: 16th August 2018