📜  mysql 添加列默认值 - SQL 代码示例

📅  最后修改于: 2022-03-11 15:05:18.854000             🧑  作者: Mango

代码示例3
-- ALTER TABLE tbl_name ADD COLUMN column_name column_definition 
--        [FIRST|AFTER existing_column];
ALTER TABLE office ADD COLUMN phone VARCHAR(200) DEFAULT '000' AFTER name;
ALTER TABLE office ADD COLUMN flag INT(1) FIRST;
ALTER TABLE office ADD COLUMN last_col INT(2);    -- Last column is default position
-- ↓ Test it (Fiddle)