1、索引操作
alter table 表名 add primary key pk_nm(列名); //增加主键索引
alter table 表名 drop primary key(列名); //删除主键索引alter table 表名 add unique(列名); //添加唯一索引
alter table 表名 add index 索引名(列1, 列2...); //添加普通索引
2、自增
alter table 表名 modify 列名 int auto_increment;
3、列的操作
alter table 表名 add 列名 varchar(255) not null; //增加字段
alter table 表名 drop 列名; //删除字段
alter table 表名 change old new varchar(255) not null; //修改