I want do column for percents..
I need write: 1.00, 2.00, 99.99, 100.. %
How I can use double type for this?
Now I have:
Double(4,2)
But when I write 100 in column I get error:
Numeric value out of range: 1264 Out of range value for column
Look at the answer here (doubleand decimal have the same syntax) or the MySQL manual:
DOUBLE[(M,D)]
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.
In short, DOUBLE(4,2) means at most 4 digits, with 2 digits after the decimal point. So to support two digits decimals until 100, you need:
double(5,2) unsigned
Note that the unsigned is not mandatory, but can be more performant and safe if you know you won't need negative values.
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