查看表的外键
select * from syscat.references where tabname='table_name';
增加主键
alter table_name add constraint ppp primary key (id)
增加表的外键。
alter table able_name add constraint f_con_name foreign key (userid)
references ub2_user (userid)
on delete restrict on update restrict;
增加去重复约束
alter table emp add constraint qwe unique(ename)
增加列约束alter table emp add constraint xxx check(age>20)
select * from syscat.references where tabname='table_name';
增加主键
alter table_name add constraint ppp primary key (id)
增加表的外键。
alter table able_name add constraint f_con_name foreign key (userid)
references ub2_user (userid)
on delete restrict on update restrict;
增加去重复约束
alter table emp add constraint qwe unique(ename)
增加列约束alter table emp add constraint xxx check(age>20)