SQL/MySQL/Data Type/Decimal
Версия от 13:46, 26 мая 2010; (обсуждение)
Decimal and Numeric Data Field Syntax When 123.4567 Is Inserted
+------------+-------------+---------+----------------------------------------------+
| Syntax |Code | Display |Description |
+------------+-------------+---------+----------------------------------------------+
|DECIMAL(w,d)|DECIMAL(5,2) |123.46 |Number has been rounded up |
+------------+-------------+---------+----------------------------------------------+
|NUMERIC(w,d)|NUMERIC(7,4) |123.4567 | Exact fit. (7 digits, 4 decimal places) |
+------------+-------------+---------+----------------------------------------------+
|DECIMAL(w) |DECIMAL(9) |123 |No decimal specified: defaults to 0 decimal. |
| | | |(9 digits, 6 padded places to left of number) |
+------------+-------------+---------+----------------------------------------------+
|DECIMAL |DECIMAL |123 |Default: 10 digits, 0 decimal places. |
| | | | (10 digits, 7 padded places to left of number)|
+------------+-------------+---------+----------------------------------------------+