外国关键参考交界表创建问题
我有两个桌子在两者之间,因为事实之间有很多关系。我如何将外键参考从一个表到接线表获得特定ID(相对表的主要密钥ID),ID是由接线表的主要密钥的一部分两个桌子的两个外键。我将外键参考直接引入交界表,但它抛出了一个错误:“外键的参考列列表中的列数与引用表中的主要键的列数不匹配” 。我该怎么办才能成功地提及交界表?
I have two tables that have a junction table in between due to fact that there is many to many relationship between. How do I make a foreign key reference from one of the tables to the junction table to obtain a specific ID(the primary key ID of the opposite table), the ID is part of the primary key of the junction table that is made up of two foreign keys of the two tables. I made a foreign key reference straight to the junction table but its throwing an error "The number of columns in the referencing column list for foreign key does not match those of the primary key in the referenced table" when launching the CREATE query for the tables. What should I do to successfully make a foreign key reference to junction table?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这两种关系的许多 将在接口表中(用SQL编写)
DBFIDDLE 在这里。
The many side of both relationships will be at the junction table eg (written in SQL)
DBfiddle here.