Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MYSQL FLOAT #202

Open
uaoleg opened this issue Feb 16, 2021 · 0 comments
Open

MYSQL FLOAT #202

uaoleg opened this issue Feb 16, 2021 · 0 comments

Comments

@uaoleg
Copy link

uaoleg commented Feb 16, 2021

Perhaps this example could explain.

CREATE TABLE test(fla FLOAT,flb FLOAT,dba DOUBLE(10,2),dbb DOUBLE(10,2));
We have a table like this:

+-------+-------------+
| Field | Type |
+-------+-------------+
| fla | float |
| flb | float |
| dba | double(10,2)|
| dbb | double(10,2)|
+-------+-------------+
For first difference, we try to insert a record with '1.2' to each field:

INSERT INTO test values (1.2,1.2,1.2,1.2);
The table showing like this:

SELECT * FROM test;

+------+------+------+------+
| fla | flb | dba | dbb |
+------+------+------+------+
| 1.2 | 1.2 | 1.20 | 1.20 |
+------+------+------+------+
See the difference?

We try to next example:

SELECT fla+flb, dba+dbb FROM test;
Hola! We can find the difference like this:

+--------------------+---------+
| fla+flb | dba+dbb |
+--------------------+---------+
| 2.4000000953674316 | 2.40 |
+--------------------+---------+

Source: https://stackoverflow.com/a/28511784/676479

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant