添加字段的語法:alter table tablename add (column datatype [default value][null/not null],….);
修改字段的語法:alter table tablename modify (column datatype [default value][null/not null],….);
刪除字段的語法:alter table tablename drop (column);
注:添加、修改、刪除多列的話,用逗號隔開。
表字段的重命名:alter table tablename rename column FIELD_NAME to NEW_FIELD_NAME;
alter table tablename rename to new_table_name;
查找表約束:select constraint_name from user_cons_columns a where a.table_name='tablename';
增加表約束:alter table tablename add constraint pk_name primary key(column);
刪除表約束:alter table tablename drop constraint constraint_name----(SYS_C002715);
修改表約束:1)禁用表主鍵:alter table tablename disable primary key;
2)啟用表主鍵:alter table tablename enable primary key;
3)重命名表主鍵:alter table tablename rename constraint pk_id to new_pk_id;