[英]Alter table add column and set default value using the table records in MySQL
[英]Alter table add column and set default value in MySQL
有没有办法在 MySQL 中添加新列并设置其默认值? 当我运行此命令时,出现语法错误:
ALTER TABLE tableName ADD newColumn varchar(20) SET DEFAULT 'test';
我找到的文档并没有真正帮助我。
SET
不是必需的:
ALTER TABLE tableName ADD newColumn varchar(20) DEFAULT 'test';
试试这个
ALTER TABLE tableName ADD COLUMN newColumn VARCHAR(20) DEFAULT 'test';
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.