ER Diagram PDF
ER Diagram PDF
Information Systems
ICT2405 - Software Engineering
ER Diagram
2
What is it about?
3
The Entity Relationship Model
• Perspective
Physical
ERM Relational
data
Model
storage
• Entities
• Relationships
• Attributes
5
Entities
• Entity - distinguishable “thing” in the real world
• Strong (or regular) entity - entities have an
independent existence (e.g. staff)
• Weak entity - existence dependent on some
other entity (e.g. next of kin)
7
Notation for attributes
Primary Key
marked {PK} EntityName
keyAttribute {PK}
compositeAttribute Composite
attribute
partOne
partTwo
Derived
/ derivedAttribute
Attribute
multiValued [min..max]
{PPK}
Partial Key Multi-Valued
- part of composite PK Attribute
- or of a weak entity (number of
values in [ ]
brackets)
8
Relationships
• A relationship is
“.. An association among entities (the
participants)..”
Entity1 Entity2
HasLinkWith
10
Relationships: Degree
Entity1 Entity2
Binary relationship HasLinkWith
Supervisor Supervises
Entity1
Staff Recursive (Unary) relationship -
example
Supervisee
Entity1 Entity3
TernaryRelationship
Complex relationship –
here ternary Entity2
11
Relationships: Multiplicity
Entity1 Entity2
HasLinkWith
1..1 0..*
Manages
Manager Department
1..1 0..3
responsibility [1..*]
dateAllocated
Each manager
Each manages UP TO 3
department departments
Relationship
is managed by (but need not manage
attributes
ONE manager any department)
13
Over to You now!
• See if you can draw an E-R diagram for this scenario – you
are already familiar with this!
• “A student registers for up to 8 modules and each module has many
students on it. Record the student ID, their full name and address
and also each module ID and title. We also want to hold the grade
attained by each student for each module”
• Remember to show in your model:
• All primary keys,
• Entities
• Relationships
• Attributes
14
Unary Example with Data
STAFF
Member Age Supervisor
Grey 43 Black
Black 27
Brown 35 Black
White 33 Brown
15
Ternary Diagrams are Tricky!
“a client at a branch will “a member of staff will
be registered by one register a client at one
member of staff” branch”
1..1 1..1
Staff registers Branch
0..*
“a member of staff at a
Client branch may register many
clients”
Try to determine participation/cardinality by operating in pairs
16
Key Points
• ERM
• Entities (strong, weak)
• Attributes (simple, composite, etc)
• Relationships
• Degree
• Cardinality
• participation
17