Общие > Базы данных
десятичные числа в базе mysql
Wyclef:
--- Цитировать ---Integers are represented as a sequence of digits. Floats use `.\' as a decimal separator.
--- Конец цитаты ---
--- Код: ---mysql> create table test (num float(10,2));
Query OK, 0 rows affected (0.14 sec)
mysql> describe test;
+-------+-------------+------+-----+---------+-------+---------------------------------+
| Field | Type | Null | Key | Default | Extra | Privileges |
+-------+-------------+------+-----+---------+-------+---------------------------------+
| num | float(10,2) | YES | | NULL | | select,insert,update,references |
+-------+-------------+------+-----+---------+-------+---------------------------------+
1 row in set (0.03 sec)
mysql> insert into test values(\'19.5\');
Query OK, 1 row affected (0.00 sec)
mysql> select num from test;
+-------+
| num |
+-------+
| 19.50 |
+-------+
1 row in set (0.02 sec)
--- Конец кода ---
Навигация
Перейти к полной версии