列操作详解

 

--增加列
alter table 表名 add(
	列名 类型 [not null/primary key],
	……
);

--删除列,如有多列(列名1,列名2,……)
alter table 表名 drop column 列名;

--标记列未使用
alter table 表名 set unused column 列名;

--删除未使用列
alter table 表名 drop unused columns;

--修改列名
alter table 表名 rename column 老列名 to 新列名

--修改列属性
alter table 表名 modify (列名 类型);

 

--添加约束
alter table 表名 add constraint 约束名 [primary key | unique | check ](列名);

--删除约束
alter table 表名 drop constraint 约束名;

 

你可能感兴趣的:(详解)