MySQL - How do I update the decimal column to allow more digits?

前端 未结 4 1439
情话喂你
情话喂你 2021-02-18 22:13

I\'m a beginner in MySQL, and I accidentally created a table with a column named

(price decimal(2,2));

It needs to be decimal(4,2)

4条回答
  •  你的背包
    2021-02-18 22:53

    Just ALTER TABLE with the MODIFY command:

    ALTER TABLE `table` MODIFY `price` DECIMAL(4,2)
    

    This would allow for 2 decimals and 2 full numbers (up to 99.99). If you want 4 full numbers, use 6,2 instead (which would allow up to 9999.99).

提交回复
热议问题