Conversion of ER Diagram to Relational Model

In this article we are going to discuss about the types of Relations, some basics of Relational model and how to convert a ER Diagram into Relational model?
Submitted by Prerana Jain, on May 17, 2018


Relations specify that how a entity of a entity set is related to the entity of other set.

Types of Relationship

There are following types of relationships

1) One to One

Every element of the first set is related to almost element of the entity set & Vice versa.

2) One to Many

A relationship is said to be one to many if every entity of the first entity set can relate to any number of entity of other entity set. But every entity of the other entity set can relate to almost One entity of the first entity set.

3) Many to Many

A relationship is said to be Many to many if any entity of the first entity set may relate to any one of the entities of other entity set and vice versa.

Relational Model

  1. In Relational model relationship between records is represented by a relation that contains a key for each record involved in the relations.
  2. Relational model is useful for representing most of the real world objects and relationships most of the real world objects and relationships among them.
  3. Relational model does not maintain physical connection among records.
  4. In relational model data is organised logically in the form of rows and columns and stored in table.
  5. In relational model many to many relationship can be easily implemented.
  6. In relational model for maintaining the data integrity Normalization method is used.

Advantages of Relational model

  • Structural independence
    Relational database model are structural independent because any changes made in the database does not affect the original database.
  • Simplicity
    The relational model is the simplest model at the conceptual level.
  • Ease of designing
    The relational model makes it easy to design, implement, maintain and use the database.
  • Query capability
    One of the main reason for the huge popularity of the relational database model is the presence of powerful, flexible and easy to use query capability.

Conversion of ER Diagram to Relational model

  • 1) Mapping regular/strong entity
    For each strong entity set create a new relational independent table that includes all attributes as column. For composite attribute include only component attributes.
  • 2) Mapping weak entity
    Convert every weak entity set into a table where we take the discrimination attribute of the weak entity set and takes the primary key of the strong entity set as a foreign key and then declared the combination of discriminator attribute and foreign key as a primary key.
  • 3) Mapping 1:1 Relationship
    For a 1:1 Relationship between two entities S and T. Choose one of the relations, Example - S and include as foreign key in S the primary key of T. It is better to choose on entity total participation on S and include descriptive attribute.
  • 4) Mapping 1:N Relationship
    For 1:N relationship identify the entity S on N side of the relationship. Include a foreign key in S the Primary key of relation T also include Discipline attributes of 1:N attribute of S.
  • 5) Mapping N:N Relationship
    For each M:N relationship create a new relational table include in the new relation ,the primary key of the participating entities as a well as descriptive attributes. The primary key of the table will be the combination of primary keys of participating entities.
  • 6) Mapping Multi-valued attribute
    For every multi-valued attribute will make a new table where we will take primary key of main table as a foreign key and multi-valued attribute as a primary key.

Related Tutorials


Comments and Discussions!

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© some rights reserved.