关键字(7):属性的增删改add,drop,modify

新建一张表:
create table nac_user.a_bt(dept varchar2( 5));   注意:新建表时,表里面至少要有一个字段
 
删除整张表:
drop table nac_user.a_bt;
 
增加表的一个属性:
alter table nac_user.t_p_merchant add sex char(1 ) default('M')
新增外键属性:
alter table T_FIX_BIND_ROUTE add constraint FK_T_FIX_BI_REFERENCE_T_L_TERM foreign key (LT_TERMNO, LT_MERCHNO) references T_L_TERMINAL (LT_TERMNO, LT_MERCHNO);
 
删除表的一个属性: 
alter table nac_user.t_p_merchant drop (pm_status)
 
更改表的一个属性:
alter table nac_user.t_p_merchant modify dept char(10 )(原来dept char(20))此时要保证dept下的值长度没有超过10)
 
删除约束
alter table dept drop unique (dname,loc) --指定约束的定义内容
alter table dept drop constraint dept_dname_loc_uk --指定约束名

禁用/激活约束(禁用/激活约束会引起删除和重建索引的操作)
alter table employees disable/enable unique email
alter table employees disable/enable constraint emp_ename_pk
http://www.codesky.net/article/200911/143229.html
 
 
原文地址:https://www.cnblogs.com/bitter-first-sweet-last/p/3949204.html