Inheritance relationship in ERD diagrams

user3151426 picture user3151426 · Apr 25, 2015 · Viewed 16k times · Source

I have question about inheritance representation in ERD-diagram. The following example: I have plane, and I have also two types of planes 1-PersonsPlane 2-CargoPlane I am confused about which relationship to use ( 1-to-1 OR 1-to-Many). My DB teacher told me that I should use a 1-to-1 relationship, But I have found on the internet many examples use (1-to-Many) relationship instead of (1-to-1). Check these images:

One-to-One relationship One-to-One relationship

One-to-Many relationship One-to-Many relationship

Which one is correct??

Answer

Nir-Z picture Nir-Z · Apr 29, 2015

inheritance relationship in ERD should be represented as One-To-One relationship or One or Zero-to-One relationship depending on the case.

1) 0..1-1 : If there could be an entity of plane since plane can exist without having child entity like cargo or personal but cargo and personal cannot exist without having a parent plane entity.

2) 1-1: If each entity cannot exist by it self. The PK in plane is the foreign key and primary key in cargo and personal child tables.

I don't think that in any case it is a one-to-many and I will give you an example: a db record of plane pk=1. Two db record of personal plane with foreign key=1 referencing one record in parent plane table. This means that there are two children entities with same key which is wrong. There must be only one referenced record in the child table thus 0..1-1 or 1-1 relationship.