一、引用剛師兄的一個例子,這是他在他機器上執行的結果
mysql> desc t12; +-------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------+---------------+------+-----+---------+-------+ | c1 | float(10,2) | YES | | NULL | | | c3 | decimal(10,2) | YES | | NULL | | +-------+---------------+------+-----+---------+-------+ 2 rows in set (0.00 sec) mysql> desc t13; +-------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------+---------------+------+-----+---------+-------+ | c1 | double(10,2) | YES | | NULL | | | c3 | decimal(10,2) | YES | | NULL | | +-------+---------------+------+-----+---------+-------+ 2 rows in set (0.00 sec) mysql> truncate table t12; Query OK, 0 rows affected (0.06 sec) mysql> truncate table t13; Query OK, 0 rows affected (0.05 sec) mysql> insert into t12 values(1234567.23,1234567.23); Query OK, 1 row affected (0.01 sec) mysql> insert into t13 values(1234567.23,1234567.23); Query OK, 1 row affected (0.01 sec) mysql> select * from t12; +------------+------------+ | c1 | c3 | +------------+------------+ | 1234567.25 | 1234567.23 | +------------+------------+ 1 row in set (0.00 sec) mysql> select * from t13; +------------+------------+ | c1 | c3 | +------------+------------+ | 1234567.23 | 1234567.23 | +------------+------------+ 1 row in set (0.00 sec)
三、查詢<深入淺出MySQL>原因為: