Is it okay to store money values as decimal(22,2)
in MySQL? I am writing a web based marketplace and Ad network for a virtual world.
What if someone has sextillion dollars?!? The field couldn't contain this massive pile of benjamins....
In seriousness though, SQL Server and PostgreSQL have a money datatype, and Access has a currency datatype. Oracle and MySQL have neither.
This thread - Best data type for storing currency values in a MySQL database
however recommends 4 significant digits for some reason, I suppose in case you need fractional cents (stock shares, etc).
If no user could have over sextillion dollars (in seriousness), and you don't need to calculate fractions of cents for storage, your format should be just fine.
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