# Converting ER Diagrams to Tables in DBMS

**Converting ER Diagrams to Tables**

Following rules are used for converting an ER diagram
into tables.

** ****Rule-01: Convert strong entity into a table**

- A strong entity set with only simple attributes will directly convert into one table.
- All Attributes of the entity set will be the attributes of the table.
- The primary key of the entity set will be the key attribute of the table.

All composite attributes convert as simple attributes
in the table.

Schema: Student ( Roll_no, First_name, Last_name ,
House_no, Street , City )

**Rule-03: Convert multivalued attributes of strong entity
into table.**

- · Split the relations of multivalued strong entity set into two tables.
- · One table define all the simple attributes with the primary key and other table define multi valued attributes with primary key.

Example

**Rule-04: Convert Relationship Set into a Table**

- A relationship set will convert into one table.
- Relationship table have primary keys of connected entities and own attributes.
- Set of non-descriptive attributes will be the primary key.

Example

Schema: Works in ( Emp_no , Dept_id , since )

### **Rule-05: Convert Binary Relationships (Cardinality
Ratios) into the table.**

The following four cases are possible

Case-01: Binary relationship with cardinality ratio
m:n

Case-02: Binary relationship with cardinality ratio
1:n

Case-03: Binary relationship with cardinality ratio
m:1

Case-04: Binary relationship with cardinality ratio
1:1

**Case-01: For Binary Relationship With Cardinality
Ratio m:n**

#### **Case-02: For Binary Relationship With Cardinality
Ratio 1:n**

NOTE- The combined table will be drawn for entity set B and relationship set R.

**Case-03: For Binary Relationship With Cardinality
Ratio m:1**

NOTE- Combined table will be drawn for the entity set A and relationship set R.

**Case-04: For Binary Relationship With Cardinality
Ratio 1:1**

**Way-01:** AR
( a1 , a2 , b1 ) 2. B ( b1, b2 )

**Way-02: **A
( a1 , a2 ) 2. BR ( a1 , b1 , b2 )

### **Rule-06: Convert Binary Relationship With Both
Cardinality Constraints and Participation Constraints into the table.**

The total participation constraint acquires NOT NULL
constraint foreign key.

**Case-01: In Binary Relationship (Cardinality
Constraint and Total Participation Constraint) From One Side (**cardinality ratio = 1 : n)

Then, two tables will be required 1. A ( a1 , a2 ). 2.
BR ( a1, b1 , b2 )

**Case-02: In Binary Relationship (Cardinality
Constraint and Total Participation Constraint) From Both Sides**

If a key constraint from both the sides of an entity is set with total participation, then the binary relationship is represented only
single table.

### **Rule-07: Convert Binary Relationship with weak Entity
Set into the table**

Weak entity sets are always used in association with
identifying relationship and total participation constraints.

============================================================

## 0 Comments