admin 管理员组文章数量: 887021
2024年2月27日发(作者:html只读文本框)
+-------+-------+ | id | id2 | +-------+-------+ | 1.235 | 1.235 | +-------+-------+ 1 row in set (0.00 sec)
mysql> insert into temp2 values(3.3,4.4); Query OK, 1 row affected (0.09 sec)
mysql> select * from temp2; +-------+-------+ | id | id2 | +-------+-------+ | 1.235 | 1.235 | | 3.3 | 4.4 | +-------+-------+ 2 rows in set (0.00 sec)
mysql> select id-id2 from temp2; +---------------------+ | id-id2 | +---------------------+ | 0 | | -1.1005 | +---------------------+ 2 rows in set (0.00 sec)
mysql> alter table temp2 modify id decimal(10,5); Query OK, 2 rows affected (0.28 sec) Records: 2 Duplicates: 0 Warnings: 0
mysql> alter table temp2 modify id2 decimal(10,5); Query OK, 2 rows affected (0.15 sec) Records: 2 Duplicates: 0 Warnings: 0
mysql> select * from temp2; +---------+---------+ | id | id2 | +---------+---------+ | 1.23500 | 1.23500 | | 3.30000 | 4.40000 | +---------+---------+ 2 rows in set (0.00 sec)
mysql> select id-id2 from temp2; +----------+ | id-id2 | +----------+ | 0.00000 | | -1.10000 | +----------+ 2 rows in set (0.00 sec)
版权声明:本文标题:MySQL中float、double、decimal三个浮点。。。 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.freenas.com.cn/free/1709018370h536551.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论