存储金钱

在mysql中DECIMAL和NUMERIC类型是一样的,These types are used when it is important to preserve exact precision, for example with monetary data.

In a DECIMAL column declaration, the precision and scale can be (and usually is) specified. For example:

1
salary DECIMAL(5,2)

Standard SQL requires that DECIMAL(5,2) be able to store any value with five digits and two decimals, so values that can be stored in the salary column range from -999.99 to 999.99.

Java的BigDecimal和mysql的decimal类型对应