//用alert修改约束除了not null外,改变其它的约束都要加constraint关键字,比如
alert table table_1 add[modify] username not null;
alert table table_1 add constraint pk_userid primary (userid);
alert table table_1 add constraint fk_userid foreign key (userid) references user(userid);
alert table table_1 add constraint unique_cardid unique(cardid);
alert table table_1 add constraint chk_sex check(sex in('男','女'));
//删除约束
alert table table_1 drop constraint chk_sex
//删除主键约束 ,必须带上cascade
alert table table_1 drop primary key userid cascade;
//显示当前用户所有的约束信息
select constraint_name,constraint_type,status ,validated
from user_contraints where table_name='表名'
//显示约束列的信息
select column_name,position
from user_cons_columns where constraint_name='约束名'
//更改表名
rename old_tableName to new_tableName;