What is the best data type to store 18 digit numeric value in MySQL
18
0
There are multiple datatypes
BIGINT
FLOAT(18,0)
DECIMAL(18,0)
DOUBLE(18,0)
What is the industry standard and most efficient datatype in MySQL for storage and retrival of such values.
Use BIGINT UNSIGNED
. It can support at least 19 digits of precision. The maximum value is 18446744073709551615.
There's no advantage to using DECIMAL, FLOAT, or DOUBLE in this case, because you say the values have no scale.
But you do need 18 digits of precision, so the rounding behavior of FLOAT/DOUBLE may not do what you need.
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