1:删除列
1
|
alter table 【表名】 drop 【列名】
|
2:增加列
1
|
alter table 【表名】 add 【列名】 int not null comment '注释说明'
|
3:修改列的类型信息
1
|
alter table 【表名】modify 【列名】 char(10)
|
4:重命名列
1
|
alter table 【表名】【列名称】【新列名】
|
5:重命名表
1
|
alter table 【表名】 rename 【新表名】
|
6:删除表中主键
1
|
alter table 【表名】 drop primary key
|
7:添加主键
1
|
|
8:添加索引
1
|
alter table 【表名】 add index INDEX_NAME (name);
|
9:添加唯一限制条件索引
1
|
alter table 【表名】 add unique emp_name2(cardnumber);
|
10:删除索引
1
|
alter table 【表名】 drop index emp_name;
|
11:加主关键字的索引
1
|
alter table 【表名】 add primary key(id);
|
12:增加字段
1
|
alter table 【表名】 add field_name field_type;
|
13:修改原字段名称及类型:
1
|
alter table 【表名】 table old_field_name new_field_name field_type;
|
14:删除字段:
1
|
alter table 【表名】 drop field_name;
|