数据库设计-ERD。建模问题
希望有人能够快速建议我建模 ERD 的最佳方法(我使用的是 IDEF1X 和 ERWin,而不是 Chen Notation),尽管这并不重要。
基本上,我有三个实体
- 组织
- 人员
- 受托人
业务规则规定受托人可以是个人或组织。
我的问题是,与受托人有两个主要的外键关系是否正确。组织之一>受托人和第二个从人>受托人。受托人的 FK 字段之一将始终为 NULL,具体取决于受托人是个人还是组织。
或者在个人和组织(person_organization)之间建立某种关联表并根据 person_Organization > 创建 PK、FK 关系会更好吗?受托人。
第二种选择似乎更好,因为可能还有其他实体也需要链接到组织和个人。
希望这是有道理的。
提前非常感谢
Hopefully someone may be able to quickly advise the best way for me to model my ERD (I'm using IDEF1X & ERWin not Chen Notation) although it doesn't really matter.
Basically I have Three Entities
- Organisation
- Person
- Trustee
Business rules state that a Trustee can be either a person or organisation.
My question is, would it be correct to have two primary, foreign key relationships to Trustee. One from Organisation > Trustee and the second from Person > Trustee. Where one of the FK fields of Trustee will always be NULL depending on if the Trustee is a person or organisation.
Or would it be better to have some sort of associative table between person and organisation (person_organisation) and create a PK, FK relationship from person_Organisation > Trustee.
The second option seems better as there might be other entities that also need to link to both Organisation and person.
Hopefully that makes sense.
Many many thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
编辑
好吧,这也应该有效:
EDIT
Well, this should work too:
在我看来,受托人只是一个人在组织中可以扮演的角色的一个例子。实际上,我们正在讨论一个三向关联 Person_Organization_Role,其中所有三个都是主键。现在,可以分解为 Person_Organization > PO_Role,但我的偏好是不要走那么远。
It seems to me that Trustee is just one example of a role a person can play in an organisation. So really, we're talking about a three-way association Person_Organization_Role where all three are the primary key. Now, that could be broken down into Person_Organization > PO_Role, but my preference is not to take things that far.