How to specify decimal precision and scale number in MySQL using phpMyAdmin

前端 未结 1 1231
轮回少年
轮回少年 2021-02-13 09:58

SQL enables MySQL users to allocate a filed in Decimal format with specific Precision and Scale numbers as:

CREATE TABLE test_table
(
    test_column DECIMAL(6,4         


        
相关标签:
1条回答
  • 2021-02-13 10:54

    Decimals can be added to a MySQL database by using the DECIMAL(M,D) data type. This requires 2 arguments.

    • M is the maximum number of digits, ranging from 1 to 65.
    • D is the number of decimal places available, ranging from 0 to 30.

    Note that with D digits reserved for decimal places, there can be at most M-D digits available for the integer part. So if we use DECIMAL(6,4), the number 45.8239 would be valid, but 456.12 would not.

    To use this in phpMyAdmin, you can do the following:

    In the Length/Value field type 6,4 without the parentheses.

    enter image description here

    results in a table structure like this:

    enter image description here

    0 讨论(0)
提交回复
热议问题