主要钥匙可以在两个不同表中充当外键吗?
我当前正在制作基本的Minecraft项目列表数据库设计,并且我想知道我是否可以在评论表和列表表中使用外键参考ID_PLAYER =“ nofollow noreferrer”>
Im currently making a basic minecraft item listing database design, and im wondering if i can reference id_player with a foreign key in the Reviews Table and Listing Table
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,您可以有多个约束,可以引用相同的主要(或唯一)约束。
如果愿意,则最多可以拥有4,294,967,292个外键,该键参考相同的主键(因为数据库中的最大约束数为4,294,967,293,但您需要一个主密钥约束)。
来自 oracle数据库参考,附录A.3逻辑数据库限制
Yes, you can have multiple constraints that can reference the same primary (or unique) constraint.
If you wanted to, you could have up to 4,294,967,292 foreign keys that reference the same primary key (since the maximum number of constraints in a database is 4,294,967,293 but you would need one primary key constraint).
From the Oracle Database Reference, Appendix A.3 Logical Database Limits