db.xml - decimal?

Permalink
Hi,

I need to add a DB column which will be a decimal number, I found this:
<field name="Income" type="decimal" size="10.2">
      <default value="1000" />
</field>


Would size="10.4" be 4 decimal places? What does the 10 mean?

Thanks
Dave

madesimplemedia
 
mlocati replied on at Permalink Best Answer Reply
mlocati
10.2 means that the field can have at max 10 digits (including those after the dot), and a precision of 2 decimal digits.

So, the field will be able to contain values between -99999999.99 and 99999999.99

For reference:https://dev.mysql.com/doc/refman/5.7/en/precision-math-decimal-chara... (in this example, 10 is the precision and 2 is the scale).
mlocati replied on at Permalink Reply
mlocati
PS: if you specify more decimal digits (the "scale") than the allowed ones, the number will be rounded automatically.
madesimplemedia replied on at Permalink Reply
madesimplemedia
Thanks, that's good to know.