mysql添加一列,并设置自增

注意设置自增时要将该字段设置为主键,如果不指定插入位置则默认为列名的最后。

 alter table test.student add column indexxx int(14) primary key auto_increment;

指定插入在某一列之后

alter table test.student add column indexxx int(14) primary key auto_increment after 列名;

指定插入到第一列

alter table test.student add column indexxx int(14) primary key auto_increment after first;
原文地址:https://www.cnblogs.com/yoyowin/p/13541951.html