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

前端 未结 4 1451
情话喂你
情话喂你 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:52

    It's not a matter of 'UPDATE' it's a matter of changing your table's structure. For that, use ALTER TABLE with MODIFY clause:

    ALTER TABLE YourTableName MODIFY COLUMN price DECIMAL(4,2);
    

    sqlfiddle demo

提交回复
热议问题