×

Conversion of ER Diagram into Relational Model

After designing the Entity-Relationship diagram, you need to convert it into tables in the relational model. Because the relational model can be easily implemented by the Relational DBMS like Oracle, MySQL, etc.

There are some rules for converting the ER diagram into tables which are as follows:

Rule1: Conversion of an entity set into a table

a) Representation of Strong entity set with simple attributes

Create a relation R for each strong entity set. Simple attributes of an entity set in the ER diagram and relation will be the same. And the key of an ER diagram will become a primary key of the relation.

For example:

Table Employee

Table: Employee

employee_id name Age city mobile no

b) Representation of Strong entity set with composite attributes

While converting the ER diagram into the Relational model, the composite attributes can be merged as individual columns.

For example:

Table Student

Table: Student

Roll no First Name Middle name Last name Course

c) Representation of Strong entity set with a multivalued attribute

The multivalued attribute is represented by double line ellipse in the ER diagram. While converting the ER diagram into the Relational model, strong entity with multivalued attribute requires two tables in the relational model. One table represents the simple attributes with the primary key, and the other represents all multivalued attributes with the primary key.

For example:

Table Employee1

Table: Employee

Employee_id Name Age

Table: Employee_e-mail

Employee_id e-mail Phone

d) Representation of Weak entity set

Create a relation R for each weak entity set. All the attributes of the weak entity set in the ER diagram will become the columns of the relation R. But the key attribute in the ER diagram cannot form the primary key of the relation. You have to add a foreign key, which would be the primary key column of its strong entity.

For example:
In below ER diagram, the Subjects is the weak entity set. Hence, create a relation for it. The field Subjects_id and Subjects_name form the column of this relation. Although Subjects_id is represented as a key attribute in the ER diagram, it cannot be considered as a primary key in the relation model. To add the primary key to the field in the relation, find the foreign key first. The Course is the strong entity related to Subjects. Hence, the Course_id, which is a primary key of Course, is added to Subjects relation as a foreign key. Now, create a composite key by using Course_id and Subjects_id.

Table Course
Table course 2

Rule 2: Conversion of Relationship into relation

Create a relation for each relationship and add the primary keys of all participating entities as an attribute of relation with their respective data types. If a relationship in an ER diagram has any attribute, add each attribute as a column of relation. Declare all foreign key constraints and a primary key composing all the primary keys of participating entities.

For example:

Table Works_in

Table: Works_in

Joining_Date employee_id Department_id

Related Topics

Domain Constraints in DBMS

Introduction about DBMS:- DBMS stands for DataBase Management System. DBMS(DataBase Management System) is a type of software by which we can save and retrieve the user's data with the security process....

3 minutes read.

Inference Rules

Armstrong’s axioms are the complete set of basic inference rules used to infer all the functional dependencies on the relational database. An inference rule is a type of assertion that a user can...

2 minutes read.

Components of Relational Database Management System

A relational database management system compromises various component. Tables, records, attributes, instances, schemas and keys together form a relational database. In this page, we will discuss each component of RDBMS in...

4 minutes read.

Types of DBMS

Database Management System A software that is programmed to enable the user to create and maintain a database. Using DBMS, we can implement create, read, update and delete operations on the...

4 minutes read.

Deadlock in DBMS

Deadlock in DBMS A deadlock is an unwanted condition in which two or more transaction are waiting indefinitely for one another to give up locks. It is said to be one of the...

3 minutes read.

Relational Integrity Constraints

Relational Integrity Constraints are the set of rules that can be used to maintain the data integrity during an insert, delete and update operations into a table. These constraints are checked in the...

2 minutes read.

Hashing in DBMS: Static and Dynamic

Hashing in DBMS: Hashing is the technique of the database management system, which directly finds the specific data location on the disk without using the concept of index structure. In the...

4 minutes read.

Candidate Key in DBMS

Candidate key in DBMS: The candidate key is a single column or the set of columns that uniquely identifies the rows of data in the database table. It is a...

2 minutes read.

Codds Rule of DBMS

Codd’s Rule of DBMS Database having certain constraints and tables, need not to be a relational database system always. For perfect database management system, there are certain rules for the database,...

3 minutes read.

Integrity Constraints in DBMS

Integrity constraints in DBMS (Database Management System) are used to ensure the accuracy and consistency of data in a database. They are a set of rules that define the allowed...

1 minute read.

Database for library management system

The database can be considered the container where the data or information can be stored electronically in a computer system. Most mobile applications and websites run our day-to-day activities by...

5 minutes read.

What is Non-Relational Database

Databases can be sorted as either relational or non-relational. Non-relational data sets are now and again alluded to as "NoSQL," which represents Not Only SQL. The principal difference between these...

4 minutes read.

Er Diagram Symbols and Notations in DBMS

Entity Relationship Diagram Entity Relationship Diagrams, or ER Diagrams for short, are diagrams that show the relationships among entity sets that are stored in databases. Alternatively said, ER diagrams assist in...

6 minutes read.

Levels of Abstraction in DBMS

Data abstraction is a way to hide unwanted or irrelevant information from the end user in DBMS. It helps in enhancing the security of data, and simplifies database design using...

4 minutes read.

DBMS Languages

User can access, update, delete, and store data or information in the database using database languages. The following are the databases languages in the database management system: Data Definition Language Data Manipulation...

3 minutes read.

What is Transaction in DBMS

A transaction is a collection of logically related operations which reads and possibly updates the various data items in the database. Usually, a transaction is initiated by a user program written in high-level...

3 minutes read.

Checkpoint in DBMS

A checkpoint in DBMS is used to define a point of the transaction that is in a consistent state and then all the transactions will be in the committed state...

4 minutes read.

Defference between Database and Data Warehouse

Database A database is a collection of related information is called a database. It has some elements that can be mapped to real-world objects. It is designed in such a manner...

4 minutes read.

Secondary Key in DBMS

What are Keys? Keys in DBMS are the attributes or set of attributes that uniquely identify a row in a set of relations. A table (relation) can have a column or...

3 minutes read.

Redundancy in Database Management System

Redundancy in a database management system (DBMS) refers to the duplication of data within the database. This duplication can occur in multiple ways, such as having multiple copies of the...

13 minutes read.