Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 19

ER Diagram

Relationships
Example….
• Students is enrolled in courses

Course CourseId sem

Student Course
Relationship Instances (1/2)
Terminology..
• The relationship set R is a set of relationship instances ri, where each ri
associates n individual entities (e1, e2, …, en), and each entity ej in ri is
a member of entity set Ej, 1 <= j <= n

Relation type R
among n entity types
E1, E2, …., En defines
a relationship set
among entitities
from these entity
types
Representation of relationship in ER Diagram

R
Degree of a relationship type
Number of participating entity types

Ternary Relationship
(degree 3)
Relationships as attributes
Role names and recursive relationships (1/2)
Role names and recursive relationships (2/2)

Student

subordinate supervisor

Mentors
Recursive relationship

subordinate supervisor
Constraints
• Constraints enforce limits to data
• Constraints on relationship types limit the possible combinations of
entities that may participate in the corresponding relationship set
• Determined from miniworld situation that relationship represents
• Eg. Company has a rule that each employee must work for exactly one
department
Cardinality ratios for binary relationships
• The maximum number of relationship instances that an entity can
participate in
• 1:1
• 1:N
• N:1
• M:N
1:1
1:N
M:N
Participation constraint
• Total participation is also called existence dependency
• Partial participation

You might also like