The double type in mysql can store a wide range of values, including positive numbers, negative numbers, decimals, etc., for example: 1. Integers, such as 100, -50, 0; 2. Decimals, such as 3.14, -2.5 ;3. Scientific notation, such as 1.23e-4, 5.67E8.
Operating system for this tutorial: Windows 10 system, MySQL 8 version, Dell G3 computer.
In MySQL, DOUBLE is a floating-point data type used to store double-precision floating-point numbers (64-bit floating-point numbers). The DOUBLE type can store a wide range of values, including positive numbers, negative numbers, decimals, etc.
When you want to fill in a DOUBLE type field, you can fill in legal values, for example:
Integers: 100, -50, 0
Decimal: 3.14, -2.5
Scientific notation: 1.23e-4, 5.67E8 (representing -4 of 1.23 times 10 The sum of 5.67 multiplied by 10 to the 8th power)
The following are some examples:
CREATE TABLE my_table ( id INT, value DOUBLE ); INSERT INTO my_table (id, value) VALUES (1, 3.14); INSERT INTO my_table (id, value) VALUES (2, -6.25);
It should be noted that due to floating point precision issues, for some specific The numerical value may contain rounding errors. If high-precision numerical calculations are required, it is recommended to use the DECIMAL type instead of the DOUBLE type.
The above is the detailed content of What to fill in the double type in mysql. For more information, please follow other related articles on the PHP Chinese website!