There are three major relationship models:
-
One-to-one
One-to-One relationship ER diagram
- One-to-many
In this many records in one table correspond to the one record in another table.
Example: Every one customer can have multiple sales. So there exist one-to-many relationships between customer and sales table.
One Asset
can have multiple Maintenance
. So Asset
entity has one-to-many relationship between them as the ER model shows below.
One-to-Many Relationship ER diagram
- Many-to-many
In this, one record in one table corresponds to many rows in another table and also vice-versa.
For instance: In a company, one employee can have many skills like Java , C# etc. and also one skill can belong to many employees.
Given below is a sample of many-to-many relationship. One employee can have knowledge of multiple Technology
. So in order to implement this, we have one more table Employee Technology
which is linked to the primary key of Employee
and Technology
table.
Many-to-Many Relationship ER diagram
Asked In: Many Interviews |
Alert Moderator