Decimal(3,2) values in MySQL are always 9.99

前端 未结 2 1385
不知归路
不知归路 2021-02-02 07:41

I have a field, justsomenum, of type decimal(3,2) in MySQL that seems to always have values of 9.99 when I insert something like 78.3. Why?

This is what my table looks l

2条回答
  •  说谎
    说谎 (楼主)
    2021-02-02 08:28

    The maximum value for decimal(3, 2) is 9.99, so when you try to insert something larger than that, it is capped to 9.99. Try decimal(5, 2) or something else if you want to store larger numbers.

    The first argument is the total number of digits of precision, and the second argument is the number of digits after the decimal point.

提交回复
热议问题