Reputation: 89
I am currently working on entity relationship diagram for a database and in that, there's an account and that account A and that can be of types say A1, A2, A3, A4, A5. Initially all of them are of type A and can be converted to A1 or A2 or A3 or A4 or A5 depending on the user's choice after verification.
I know about ternary relationships but here, I have more than 3 entities. How should I create a relationship among the 6 entities: A, A1, A2, A3, A4, A5?
Suggest me some ideas or provide me some reference I can refer to. I read a few articles but couldn't find any leads. Thanks.
Upvotes: 0
Views: 2112
Reputation: 73500
Yes you can, but not in all notations and it's not a good idea for your needs.
Peter Pin-Shan Chen, the inventor of E/R modelling has defined in one of his foundational papers that relationships can relate more than two entities:
Entities are related to each other. Different types of relationships may exist between different types of entities. A relationship set is a set of relationships of the same type. For example, PROJLEMP, which describes the assignment of employees to projects, is a relationship set defined on two entity sets, EMP and PROJ. A relationship set can also be defined on more than two entity sets. For example, PROJ_SUPP_PART is a relationship set defined on three entity sets PROJ, SUPP , and PART. In the entity-relationship diagram, a relationship set is rep- resented by a diamond-shaped box with lines connecting to the related entity sets.
However this comes with two practical constraints:
A simpler solution, would be to put all the common attributes into A, and leave in A1.. A5 only the additional attributes. You would then represent the relation ship between A and An as a weak one, with a partial participation of An.
The advantatge is that you can represent this in every notation and that it's simple and unambiguous to read. It wouldn't prevent multiple relationships, so you would have to add a comment to clarify.
Another approach is to reach out for EERD notation, and realise that A1..An are specialisations of A. You would represent this with an IsA
relationship. The advantage is that it is loyal to your design and clearly explains what you mean in your narrative.
There are however several inconveniences:
Upvotes: 0