How to store decimal in MySQL?

前端 未结 6 924
谎友^
谎友^ 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:03

    The syntax is DECIMAL(M,D)

    M - total length

    D - digits right of the decimal point

    http://dev.mysql.com/doc/refman/5.6/en/fixed-point-types.html

    The declaration syntax for a DECIMAL column is DECIMAL(M,D). The ranges of values for the arguments in MySQL 5.6 are as follows:

    M is the maximum number of digits (the precision). It has a range of 1 to 65. (Older versions of MySQL permitted a range of 1 to 254.)

    D is the number of digits to the right of the decimal point (the scale). It has a range of 0 to 30 and must be no larger than M.

提交回复
热议问题