How to make Relational model from ER Diagram

In today’s post, we will learn how to make a Relational model from ER Diagram. ER diagram is just a conceptual picture of a database (Definition of ER Diagram HERE). It is one of the important tasks of the programmer to convert that diagram into tables while coding a database.

Let’s say we have to the ER Diagram of a company. The diagram has 3 strong entity sets, Employee, Department and Project with one-week entity Dependent.

How to make Relational model from ER Diagram

How to make Relational model from ER Diagram

  • Convert all string entity sets in to relations/tables.
  • Exclude mutlivalues attribute from mapping into tables. Create a seperate relation for this . Add primary key of the entity set in new relation as a foreign key. The foreign key attribute and multivalued attribute will become composite key.
  • Only consituent simple attributes will be mapped in case of composite attribute. For example Employee table has Name Composite attribute convert it into first_name, middle_name and Last_name.
  • While mapping week entity set such as dependent, include primary key of the owner entity set into week entity set.

Mapping 1:1 Relationship Types

  • Foreign Key Approach: Let R and S be two entities, find the entity with total participation (say S in the case). Add primary key of R into S as Foreign key
  • Merged Relationship Approach: If both entity sets are having total participation then they can be merged into a single relation.
  • Cross Reference Approach: Create a third relation having primary keys of both the entity sets.

Mapping 1:N Relationship Types

  • Foreign Key Approach: Let R and S be two entities, find the entity with total participation (say S in the case). Add primary key of R into S as Foreign key. Usually from 1 Side to the N side.

Mapping M:N Relationship Types

  • Create a third relation containing the primary keys of both the entity sets and descriptive attribute.

READ MORE

Databases related posts Visit HERE

Python-related posts Visit HERE

C++ related posts Visit HERE

Data Structures related posts visit HERE

Algorithms related posts visit HERE

Data Science related posts visit HERE

Share the Knowledge