SQL语句设置主外键约束

alter table 外键表名 add constraint 约束名称 foreign key(外键字段)  references 主键表名(约束列名) 
spa


如表A中的Ids是主键,要约束表B中的Aid列,那么语句应该是:table

alter table B add constraint A_B_Ids foreign key(Aid)  references A(Ids) 
tab