0% found this document useful (0 votes)
13 views17 pages

ER Diagram PDF

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views17 pages

ER Diagram PDF

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

BSc (Honours) in Computing /

Information Systems
ICT2405 - Software Engineering

ER Diagram

©Lanka Nippon BizTech Institute


Entity-Relationship
Modelling

2
What is it about?

• ER model is used to show the Conceptual schema of an


organisation.
• Independent of specific data model or DBMS

• The model is later transformed into a Logical model (e.g.


relational) on which the physical database is built

• The most widely used form of Semantic modelling: attempt to


capitalise on knowledge of meaning of data to inform the
model
• So we need a vocabulary

3
The Entity Relationship Model

• Perspective

Organisation Information System

Physical
ERM Relational
data
Model
storage

Conceptual Model Logical Model Physical Model


4
Skills and concepts

• So the concepts we want you to learn today are:


• The basics of Entity-Relationship modelling

• 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)

EntityName Entity type name


(singular, no spaces,
capital letter at start of each word)

space for attributes


6
Attributes

• Entity types have Attributes (or properties) which


associate each entity with a value from a domain of
values for that attribute
• Attributes can be
• simple (atomic) e.g. Surname; date of birth
• composite e.g. address (street, town, postcode)
• multi-valued e.g. phone number
• complex nested multi-valued and composite
• base or derived e.g. D.O.B. ; age
• key
• Relationship types can also have attributes! (see later)

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)..”

• Relationships link entities with each other

Entity1 Entity2
HasLinkWith

Name: verb, capital start letter,


arrow indicates direction in which
verb makes sense 9
Relationships: constraints

• The degree of a relationship type


• binary (connects 2 entity types)
• unary/ recursive (connects 1 entity type with itself) Degree
• complex (connects 3 or more entity types)
• Ternary (connects 3)

• Relationship constraints - cardinality


• one to one (1:1)
• one to many (1:m)
• many to many (m:n)
• Relationship constraints – participation Multiplicity
• full/mandatory
• or partial/optional

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

label lines to show cardinality and participation


0..1 “zero or one” optional
0..* “zero or more”
1..1 “one”
1..4 “between 1 and 4” mandatory
1..* “one or more”

Entity1 Entity2
HasLinkWith

1..1 0..*

Entity1 has a 1:m relationship with Entity2;


participation for Entity2 is mandatory, for Entity1 optional.
12
Relationships example

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

A member of staff may


 supervises supervise another staff
0..* member, but a staff
Staff member may be
0..1 supervised by one or more
staff members

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

• Model with the UML notation at conceptual level

17

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy