建模或关系?
如何转换 ER 图中的 OR 关系?例如,您有 2 个实体与第三个实体有某种联系,但其中只有一个可以具有这种关系?(例如 BussinessOwner 或 PrivateOwner 只能容纳一个 < em>财产)?
How do you trasnlate OR relationships in ER diagrams? For example, you have 2 entities that have some connection with the third, but only one of them can have that relation?(ex. BussinessOwner or PrivateOwner can hold just one Property) ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
选项 1(更简单):两个可为空的外键:BusinessOwnerID 和 PrivateOwnerID。
选项 2(更规范化):BusinessOwner 和 PrivateOwner 都是所有者,因此您可以使用 BusinessOwner 和 PrivateOwner 之间常见的任何信息创建一个 Owner 实体。然后将 OwnerID 添加到 BusinessOwner 和 PrivateOwner 表中。
Option 1 (easier): Two nullable foreign keys, BusinessOwnerID and PrivateOwnerID.
Option 2 (more normalized): Both BusinessOwner and PrivateOwner are Owners, so you could make an Owner entity with whatever information is common between BusinessOwner and PrivateOwner. Then add an OwnerID to both the BusinessOwner and PrivateOwner tables.
像这样:
http:// Consultingblogs.emc.com/davidportas/archive/2007/01/08/Distributed-Keys-and-Disjoint-Subtypes.aspx
Like this:
http://consultingblogs.emc.com/davidportas/archive/2007/01/08/Distributed-Keys-and-Disjoint-Subtypes.aspx
使用
owner
和Type
字段。没有 2 个所有者字段。
所有者是人实体。
类型是类型实体或字符串(“企业”所有者或“私人所有者”)
如果您添加新类型会怎样...“高级合作伙伴” 使用您的模型,您必须添加新字段并重新编码您的业务规则。
User an
owner
andType
Field.Not 2 owner Fields.
Owners are People entity.
Types are Type entity or strings ("Business" Owner or "Private Owner")
What if you add a new type... "Sr. Partner" With your model you would have to add new filed and recode your business rules.