Storing statistical data, do I need DECIMAL, FLOAT or DOUBLE?

后端 未结 6 1543
猫巷女王i
猫巷女王i 2020-12-02 15:07

I am creating for fun, but I still want to approach it seriously, a site which hosts various tests. With these tests I hope to collect statistical data.

Some of the

6条回答
  •  离开以前
    2020-12-02 15:34

    Float and Double are Floating point data types, which means that the numbers they store can be precise up to a certain number of digits only. For example for a table with a column of float type if you store 7.6543219 it will be stored as 7.65432. Similarly the Double data type approximates values but it has more precision than Float.

    When creating a table with a column of Decimal data type, you specify the total number of digits and number of digits after decimal to store, and if the number you store is within the range you specified it will be stored exactly.

    When you want to store exact values, Decimal is the way to go, it is what is known as a fixed data type.

提交回复
热议问题