alter table table_name add( column datatype [DEFAULT EXPR][,column datatype...]);
eg:
添加一列
alter table test add(name2 varchar2(20) ); alter table test add name2 varchar2(20);
添加多列
alter table test add(name3 varchar2(20),name4 number(1) );
修改列
alter table table_name modify( column [datatype] [DEFAULT EXPR][,column [datatype]...]);
eg:
修改一列
修改类型 and 默认值
alter table test modify name2 number(1) default 2;
只修改类型 or 默认值
alter table test modify name2 number(2);
alter table test modify name2 default 3;
修改多列
alter table test modify( name2 default 3,name3 default 3);
修改列名
alter table table_name rename column old_column_name to new_column_name;
eg:
alter table test rename column name20 to name22;
删除列
alter table table_name drop column column_name;
eg:
alter table test drop column name22;
添加注释
comment on column table_name.column_name is '注释';
eg:
comment on column test.id is '注释测试';
--------------------------------------------------------------------------
交流群:81552084
--------------------------------------------------------------------------