ER To Relational Model
ER To Relational Model
Student Table
Roll_id Name Gender Mobile_no Age
Composite
attribute to Table
Student Table
3 21 7877249512 [email protected]
4 21 7877249511 [email protected]
5 21 7877249522 NULL
Multivalued Student Table
Roll_no Age
attribute to Table 1
2
Mobile Table
Roll_no Mob_no
3
Email Table
Roll_no Email_id
Relationship set
• Relationship-set R
▪ Assume all participating entity-sets are strong entity sets
▪ a_1, a_2, …, a_m is the union of all participating entitysets’ primary key attributes
▪ b_1, b_2, …, b_n are descriptive attributes on R (if any)
Relational schema for R is:
▪ { a1, a 2, …, a m} U { b1, b 2, …, b n }
▪ Primary key of R depends on R’s mapping cardinality
Relationship set
to Table
Works_in Table
Tables:
Table 1
A (a1, a2)
Table 2
B (b1, b2)
Table 3
R(a1, b1)
Example on cardinality
ratio m:n
Tables:
Table 1
A (a1, a2)
Table 2
BR (a1, b1, b2)
Example on cardinality
ratio 1:n
Student Table Enrolls Table Courses Table After minimization of Tables
S2 David S2 C3 C2 OS
S3 Mohan S1 C2 C3 DS
S4 Shyam S2 C4 C4 NS
S5 John S3 C5 C5 IMS
Case-03: Binary relationship with cardinality
ratio m:1
Tables:
Table 1
AR (a1, b1, a2)
Table 2
B (b1, b2)
Example on cardinality
ratio m:1
Student Table Enroll Table Course Table After minimization of Tables
Tables:
Table 1
AR (a1, b1, a2)
Table 2
B (b1, b2)
Or
Table 1
A (a1, a2)
Table 2
BR (a1, b1, b2)
Example on cardinality
ratio 1:1
Student Table Enroll Table Course Table After minimization of Tables
student (username)
assignment (shortname, due_date, url)
submission ( username, version, shortname, submit_date, data)
MCQ
What is the min and max number of tables required to convert an ER diagram
with 2 entities and 1 relationship between them with partial participation
constraints of both entities?
• Min 1 and Max 2
• Min 1 and Max 3
• Min 2 and Max 3
• Min 2 and Max 2
MCQ
What is the min and max number of tables required to convert an ER diagram
with 2 entities and 1 relationship between them with partial participation
constraints of both entities?
• Min 1 and Max 2
• Min 1 and Max 3
• Min 2 and Max 3
• Min 2 and Max 2
MCQ