In a MySql Table i have a column with datatype double. There are two ways of displaying a decimal Number: Comma and Dot.
I've tried both and both seem to work. But I'd like to ask which of those two versions is "more" correct?
21.6
or
21,6
(Didn't find anything in the MySql documentation).
From the Number Literals manual page:
Integers are represented as a sequence of digits. Floats use “.” as a decimal separator. Either type of number may be preceded by “-” or “+” to indicate a negative or positive value, respectively
Dot has been used as decimal separator in almost every computer language since Cobol.
Using comma does not work:
mysql> SELECT 21.6;
+------+
| 21.6 |
+------+
| 21.6 |
+------+
1 row in set (0.14 sec)
mysql> SELECT 21,6;
+----+---+
| 21 | 6 |
+----+---+
| 21 | 6 |
+----+---+
1 row in set (0.00 sec)
I think you need to double check your numbers. As far as i know and as far as i can tell they havent changed this. The decimal point seprator for mysql is "." and the thousand seprator is ",".
Your best bet if you want to change this is to check the users formating when you display it to them. You cant change how its stored in the database.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With