List:General Discussion« Previous MessageNext Message »
From:John Hicks Date:July 15 2003 7:39pm
Subject:Best practice column type for storing decimal currency amounts?
View as plain text  
Is there an accepted best practice on whether to store 
decimal currency amounts (e.g. dollars and cents) in MySQL 
decimal column types? 

Certainly, the most straightforward way is to use decimal 
columns. But it appears that such values are stored as 
ASCII strings, which would be inefficient for calculations 
(requiring conversion to a numeric type for each 
calculation).

I guess the alternative would be to use integer columns 
(and multiply by 100 to store the value as total cents). 

My particular context is a PHP/MySQL sales system.

What's the consensus?

Thanks much,

--John
Thread
Best practice column type for storing decimal currency amounts?John Hicks15 Jul
RE: Best practice column type for storing decimal currency amounts?Rudy Metzger16 Jul
  • Re: Best practice column type for storing decimal currency amounts?John Hicks16 Jul
    • Re: Best practice column type for storing decimal currency amounts?Keith C. Ivey16 Jul
RE: Best practice column type for storing decimal currency amounts?Rudy Metzger17 Jul