L36-37-Converting ER Diagram To Relational Schema
L36-37-Converting ER Diagram To Relational Schema
Subject : DBMS
Subject Code: BCA-S301T
Faculty: Saurbah Jha
ER-Models Constructs
Converting ER Diagrams to Tables
ER diagram is converted into the tables in
relational model.
Other table will contain the primary key and all the
multi valued attributes.
Rule-03-Example
NOTE- Here, combined table will be drawn for the entity set
B and relationship set R.
Case-03
For Binary Relationship With Cardinality Ratio m:1
NOTE- Here, combined table will be drawn for the entity set A
and relationship set R.
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:
AR ( a1 , a2 , b1 )
B ( b1 , b2 )
Way-02:
A ( a1 , a2 )
BR ( a1 , b1 , b2 )
Thumb Rules to Remember
While determining the minimum number of tables required for
binary relationships with given cardinality ratios, following thumb
rules must be kept in mind-
Because cardinality ratio = 1 : n , so we will combine the entity set B and relationship set R.
Then, two tables will be required-
A ( a1 , a2 )
BR ( a1 , b1 , b2 )
Because of total participation, foreign key a1 has acquired NOT NULL constraint, so it can’t
be null now.
Case-02
For Binary Relationship With Cardinality Constraint
and Total Participation Constraint From Both Sides-
Solution-
Applying the rules, minimum 3 tables will be required-
MR1 (M1 , M2 , M3 , P1)
P (P1 , P2)
NR2 (P1 , N1 , N2)
Problem-02
Find the minimum number of tables required to represent the
given ER diagram in relational model-
Solution-
Applying the rules, minimum 4 tables will be required-
AR1R2 (a1 , a2 , b1 , c1)
B (b1 , b2)
C (c1 , c2)
R3 (b1 , c1)
Problem-03
Find the minimum number of tables required to represent
the given ER diagram in relational model-
Solution-
Applying the rules, minimum 3 tables will be required-
E1 (a1 , a2)
E2R1R2 (b1 , b2 , a1 , c1 , b3)
E3 (c1 , c2)
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)
Output