Dragon
主机之家测评主机之家测评  2019-08-26 19:05 主机之家测评 隐藏边栏 |   抢沙发  68 
文章评分 0 次,平均分 0.0

1:删除列

  alter table 【表名】 drop 【列名】

2:增加列

  alter table 【表名】 add 【列名】 int not null comment '注释说明'

3:修改列的类型信息

  alter table 【表名】modify 【列名】 char(10) 

4:重命名列

  alter table 【表名】【列名称】【新列名】

5:重命名表

  alter table 【表名】 rename 【新表名】

6:删除表中主键

  alter table 【表名】 drop primary key

7:添加主键

  alter table 【表名】 add CONSTRAINT PK_SJ_RESOURCE_CHARGES PRIMARY KEY (resid,resfromid)

8:添加索引

  alter table 【表名】 add index INDEX_NAME (name);

9:添加唯一限制条件索引

  alter table 【表名】 add unique emp_name2(cardnumber);

10:删除索引

  alter table 【表名】 drop index emp_name;

11:加主关键字的索引

  alter table 【表名】 add primary key(id);

12:增加字段

  alter table 【表名】 add field_name field_type;

13:修改原字段名称及类型:

  alter table 【表名】 table old_field_name new_field_name field_type;

14:删除字段:

  alter table 【表名】 drop field_name;

本文为原创文章,版权归所有,欢迎分享本文,转载请保留出处!

发表评论

扫一扫二维码分享