DBMS Unit 1
DBMS Unit 1
DBMS Unit 1
Following rules are used for converting an ER diagram into the tables-
A strong entity set with only simple attributes will require only one table in relational model.
Attributes of the table will be the attributes of the entity set.
The primary key of the table will be the key attribute of the entity set.
Example-
A strong entity set with any number of composite attributes will require only one table in
relational model.
While conversion, simple attributes of the composite attributes are taken into account and
not the composite attribute itself.
Example-
Example-
Roll_no City
Roll_no Mobile_no
Example-
NOTE-
If we consider the overall ER diagram, three tables will be required in relational model-
One table for the entity set “Employee”
One table for the entity set “Department”
One table for the relationship set “Works in”
Rule-05: For Binary Relationships With Cardinality Ratios-
Note: For binary relationship with cardinality ration m : n , separate and individual tables will be
drawn for each entity set and relationship.
NOTE- Here, combined table will be drawn for the entity set B and relationship set R.
NOTE- Here, combined table will be drawn for the entity set A and relationship set R.
For binary relationship with cardinality ratio either m : 1 or 1 : n , always remember “many side will
consume the relationship” i.e. a combined table will be drawn for many side entity set and
relationship set.
Case-04: For Binary Relationship With Cardinality Ratio 1:1
Here, two tables will be required. Either combine ‘R’ with ‘A’ or ‘B’
Way-01:
1. AR ( a1 , a2 , b1 )
2. B ( b1 , b2 )
Way-02:
1. A ( a1 , a2 )
2. BR ( a1 , b1 , b2 )
Note : For binary relationship with cardinality ratio 1 : 1 , two tables will be required. You can
combine the relationship set with any one of the entity sets.
While determining the minimum number of tables required for binary relationships with given
cardinality ratios, following thumb rules must be kept in mind-
For binary relationship with cardinality ration m : n , separate and individual tables will be drawn
for each entity set and relationship.
For binary relationship with cardinality ratio either m : 1 or 1 : n , always remember “many side will
consume the relationship” i.e. a combined table will be drawn for many side entity set and
relationship set.
For binary relationship with cardinality ratio 1 : 1 , two tables will be required. You can combine the
relationship set with any one of the entity sets.
Rule-06: For Binary Relationship With Both Cardinality Constraints and
Participation Constraints-
Because cardinality ratio = 1 : n , so we will combine the entity set B and relationship set R.
Then, two tables will be required-
1. A ( a1 , a2 )
2. BR ( a1 , b1 , b2 )
Because of total participation, foreign key a1 has acquired NOT NULL constraint, so it can’t
be null now.
If there is a key constraint from both the sides of an entity set with total participation, then
that binary relationship is represented using only single table.
Here, Only one table is required.
ARB ( a1 , a2 , b1 , b2 )
Rule-07: For Binary Relationship With Weak Entity Set-
Weak entity set always appears in association with identifying relationship with total
participation constraint.
Problem 1:Find the minimum number of tables required for the following ER diagram
in relational model-
Solution-
Problem-02:
Find the minimum number of tables required to represent the given ER diagram in
relational model-
Solution-
Problem-03:
Find the minimum number of tables required to represent the given ER diagram in
relational model-
Solution-
Problem-04:
Find the minimum number of tables required to represent the given ER diagram in
relational model-
Solution-
Problem-05:
Find the minimum number of tables required to represent the given ER diagram in relational
model-
Solution-
Applying the rules that we have learnt, minimum 6 tables will be required-
Account (Ac_no , Balance , b_name)
Branch (b_name , b_city , Assets)
Loan (L_no , Amt , b_name)
Borrower (C_name , L_no)
Customer (C_name , C_street , C_city)
Depositor (C_name , Ac_no)