Tipe desimal di MySQL memiliki dua tombol penyetelan:presisi dan skala. Anda menghilangkan skala, jadi defaultnya adalah 0.
Dokumentasi (tautan )
Contoh
mysql> create table test01 (field01 decimal(9));
Query OK, 0 rows affected (0.01 sec)
mysql> insert into test01 (field01) values (123.456);
Query OK, 1 row affected, 1 warning (0.00 sec)
mysql> select * from test01;
+---------+
| field01 |
+---------+
| 123 |
+---------+
1 row in set (0.00 sec)
mysql> create table test02 (field01 decimal(9, 4));
Query OK, 0 rows affected (0.00 sec)
mysql> insert into test02 (field01) values (123.456);
Query OK, 1 row affected (0.01 sec)
mysql> select * from test02;
+----------+
| field01 |
+----------+
| 123.4560 |
+----------+
1 row in set (0.00 sec)