job.answiz.com
  • 4
Votes
name
name Punditsdkoslkdosdkoskdo

Best data type for storing currency esteems in a MySQL database

What is the best SQL data type for currency values? I'm using MySQL but would prefer a database independent type.

It is also important to work out how many decimal places maybe required for your calculations.

I worked on a share price application that required the calculation of the price of one million shares. The quoted share price had to be stored to 7 digits of accuracy.

  • 0
Reply Report

Something like Decimal(19,4) usually works pretty well in most cases. You can adjust the scale and precision to fit the needs of the numbers you need to store. Even in SQL Server, I tend not to use "money" as it's non-standard.

  • 0
Reply Report