How to store decimal in MySQL?

前端 未结 6 926
谎友^
谎友^ 2020-12-05 06:35

I\'ve tried using DECIMAL with (2,2) but it won\'t let me use this.

I simply want to store a number, for example 7.50 or 10.50. I need to keep both numbers after th

6条回答
  •  甜味超标
    2020-12-05 07:00

    The first digit of the DECIMAL declaration is the total digits. You probably want to use DECIMAL (4, 2). This allows for up to two digits before the decimal and two after.

    Documentation: https://dev.mysql.com/doc/refman/5.7/en/precision-math-decimal-characteristics.html

提交回复
热议问题