To define a column whose data type is
DECIMAL we use the following syntax:
column_name DECIMAL(P, D)
In the syntax about:
- P is the
precisionthat represents the number of significant digits. The range of P is 1 to 65.
- D is the
scalethat represents the number of digits after the deciamal point. The range of D is 0 to 30. MySQL requires D is less than or equal to P.
cost DECIMAL(10, 2)
cost column can store 10 digits with 2 decimal places. Therefore, the range of
cost is from 99999999.99 to -99999999.99