Download as pdf or txt
Download as pdf or txt
You are on page 1of 34

ER diagrams-More Examples

ER diagrams to Relational Model


By
Prof.G.Sukanya
SCOPE
For Binary Relationships With Cardinality
Ratios-
• 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
Case-03: For Binary Relationship With
Cardinality Ratio m:1
Case-04: For Binary Relationship With
Cardinality Ratio 1:1
Thumb Rules to remember
For Binary Relationship With Both Cardinality
Constraints and Participation Constraints-
• Cardinality constraints will be implemented as
discussed already
• Because of the total participation constraint, foreign
key acquires NOT NULL constraint i.e. now foreign key
can not be null.
Case-01: For Binary Relationship With
Cardinality Constraint and Total Participation
Constraint From One Side
Case-02: For Binary Relationship With
Cardinality Constraint and Total Participation
Constraint From Both Sides-

1 1
For Binary Relationship With Weak Entity
Set-
Problem-01
Find the tables required for the following ER diagram in relational model
Problem 1-Solution
• MR1 (M1 , M2 , M3 , P1)
• P (P1 , P2)
• NR2 (P1 , N1 , N2)
Problem 2

Solution
factory(city,throughput)
assemblyline (city, number,throughput)
Problem-03
Problem 3-Solution
Problem-4
Solution
For (1:N) relationship
employee(ID,name,position,payrate,paytype,city,
supervisor_id)
factory(city,throughput)

For (1:1) relationship

factory(city,throughput,ID)
employee(ID,name,position,payrate,paytype)
Problem 5

Solution
Model(name,number,type)
Model_appli(name,number,application)
Problem 6
Step 1: Mapping Regular Entity types
Step 2:Mapping Weak entity
Step 3: : Mapping 1 : 1 Relation types
Step 4: Mapping of Binary 1:N relation types
Step 5: Mapping of Binary M:N Relationship
Types
Step 6: Mapping of Multivalued attributes
Practice Question
Consider a MAIL_ORDER database in which employees take
orders for parts from customers.
are summarized as follows:
■ The mail order company has employees, each identified by a
unique employee number, first and last name, and Zip Code.
■ Each customer of the company is identified by a unique
customer number, first and last name, and Zip Code.
■ Each part sold by the company is identified by a unique part
number, a part name, price, and quantity in stock.
■ Each order placed by a customer is taken by an employee and
is given a unique order number.
Each order contains specified quantities of one or more parts.
Each order has a date of receipt as well as an expected ship date.
The actual ship date is also recorded.

You might also like