MySQL - 如何更新小数列以允许更多位数?
我是 MySQL 的初学者,我不小心创建了一个表,其中包含一个名为
I'm a beginner in MySQL, and I accidentally created a table with a column named
(price decimal(2,2));
它需要是 decimal(4,2)
以允许 4 位数字.既然我已经创建了它,那么将该十进制值更新为 decimal(4,2)
的最简单方法是什么?还是我需要完全删除该列,然后用正确的数字重新创建它?
It needs to be decimal(4,2)
to allow 4 digits. Since I've already created it, what is the easiest way to update that decimal value to decimal(4,2)
? Or do I need to drop that column completely, and re-create it with the correct numbers?
推荐答案
ALTER TABLE mytable MODIFY COLUMN mycolumn newtype
示例:
ALTER TABLE YourTableNameHere MODIFY COLUMN YourColumnNameHere decimal(4,2)
相关文章