For storing prices you do not want to use a FLOAT. They are reliant on rounding and can have variable precision based on your system's hardware and/or software configuration.
http://dev.mysql.com/doc/refman/5.0/en/problems-with-float.html
Prices have a fixed decimal which is why you need a fixed decimal data type like DECIMAL
.
To declare a DECIMAL
column you'll need to specify the total number of digits, and the number of decimal places you'd like.
eg: to store $199.95 the column would need to be DECIMAL(5,2)
.
These are essentially stored as an integer 19995
and the decimal point is added in on retrieval. In this way you do not need to worry about gaining/losing cents randomly due to floating point precision issues.