Database design - ERD. Modeling Question

北慕城南 提交于 2019-12-01 06:09:33

问题


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

  1. Organisation
  2. Person
  3. 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


回答1:


EDIT

Well, this should work too:




回答2:


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.



来源:https://stackoverflow.com/questions/3336164/database-design-erd-modeling-question

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!