alter table 外键表名 add constraint 约束名称 foreign key (外键字段) references 主键表名(约束列名)
如果表A中的Ids是主键,要约束表B中得Aid列,那么语句应该是:
alter table B add constraint A_B_Ids foreign key(Aid) references A(Ids)
alter table 外键表名 add constraint 约束名称 foreign key (外键字段) references 主键表名(约束列名)
如果表A中的Ids是主键,要约束表B中得Aid列,那么语句应该是:
alter table B add constraint A_B_Ids foreign key(Aid) references A(Ids)
本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。