Adding a new SQL column with a default value

前端 未结 10 674
自闭症患者
自闭症患者 2020-12-02 05:15

I am looking for the syntax to add a column to a MySQL database with a default value of 0

Reference

10条回答
  •  失恋的感觉
    2020-12-02 05:33

    Another useful keyword is FIRST and AFTER if you want to add it in a specific spot in your table.

    ALTER TABLE `table1` ADD COLUMN `foo` AFTER `bar` INT DEFAULT 0;
    

提交回复
热议问题