I have to put the price of some items inside a mysql table. When creating the table I\'m using DECIMAL(10,2)
as I don\'t need more than 2 digits after the comma
DECIMAL(10,2)
means that 10
is the maximum number of digits to be used. The 2
specifies that there are two on the right side of the decimal. So this means there are 8
digits left on the left side. See the manual
As for the datatype, you should use double
as this is for decimal numbers.
Integer
has no decimal chars, so it will floor all numbers. String
is for text and not numeric values. Blob
is for a binary large object, EG: an image