本文介绍了数据库设计 - ERD。建模问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

希望有人可能能够快速建议我为我的ERD建模的最佳方式(我使用IDEF1X和ERWin不是Chen符号),尽管这并不重要。



基本上我有三个实体


  1. 组织

  2. 个人

  3. 受托人

业务规则规定受托人可以是人或组织。



我的问题是,与Trustee有两个主要的外键关系是否正确。一个来自组织>受托人,第二个来自人>受托人。受托人的FK字段之一将永远为NULL,具体取决于受托人是个人或组织。或者最好在人与组织之间建立某种关联表(person_organisation),并从person_Organisation>受托人创建PK,FK关系。



第二个选项似乎更好,因为可能还有其他实体也需要链接到组织和人员。



希望这是有道理的。



提前许多感谢

解决方案


编辑



嗯,这也应该是: / p>


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

解决方案

EDIT

Well, this should work too:

这篇关于数据库设计 - ERD。建模问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-05 03:25