In the db, it's ok to store as decimal, since it's internally an integer. However, unless your language/framework has built-in support for money, you should use a library to deal with it (Or build one). Specifically, you do NOT want to treat them as floats, so you will probably end up handling them as integer cents. Because of this, you might as well do the same in the db for consistency. Also mind that some db-layers may automatically convert decimal into floats in your application language. So the safer choice is probably to just store as integer cents. It seems to be the most common scheme, to my recall.<p>While you're at it, keep a currency-symbol/code together with your cents in the same value-object. Just like time is incomplete without a time zone, money is incomplete without a currency. You will thank me later.<p>For inspiration, [RubyMoney](<a href="https://github.com/RubyMoney/money" rel="nofollow">https://github.com/RubyMoney/money</a>) is a very well-designed library dealing with this in the context of Ruby.
Decimal, because it's straightforward. I prefer to err on the side of minimizing computations and manipulations involving price, and simple things are easier to add complexity to later if the need arises compared to the other way around.<p>+ <a href="https://dev.mysql.com/doc/refman/5.7/en/fixed-point-types.html" rel="nofollow">https://dev.mysql.com/doc/refman/5.7/en/fixed-point-types.ht...</a><p>><i>The DECIMAL and NUMERIC types store exact numeric data values. These types are used when it is important to preserve exact precision, for example with monetary data. In MySQL, NUMERIC is implemented as DECIMAL, so the following remarks about DECIMAL apply equally to NUMERIC.</i>