Lesson4 ERD
Lesson4 ERD
(Entity Relationship
Diagram)
Entity Relationship Diagrams is a major data
modelling tool and will help organize the data in
your project into entities and define the
relationships between the entities.
Components of an ERD
An ERD typically consists of three different graphical
components:
1. Entity - Rectangle
2. Attributes - Ovals
3. Relationship - Diamond
Entity
A data entity is anything real or abstract about which
we want to store data.
Entity types fall into five classes: roles, events,
locations, tangible things or concepts.
Students
Attribute.
A data attribute is a characteristic common to all or most
instances of a particular entity. Synonyms include
property, data element, field.
E.g. Name, address, Employee Number, pay rate
are all attributes of the entity employee.
An attribute or combination of attributes that uniquely
identifies one and only one instance of an entity is called
a primary key or identifier.
E . g. E m pl oy ee N um ber i s a pr i m ar y k ey f o r
Employee.
Relationship
4. Fill in Cardinality
Determine the number of occurrences of one entity
for a single occurrence of the related entity.
5. Define Primary Keys
Identify the data attribute(s) that uniquely identify
one and only one occurrence of each entity.
7. Identify Attributes
Name the information details (fields) which are
essential to the system under development.
8. Map Attributes
For each attribute, match it with exactly one entity
that it describes.
Is
assigned
works
EMPLOYEE on
PROJECT
Figure 2
What is Relationship?
Is
assigned
works
EMPLOYEE on
PROJECT
Figure 4
Rough ERD plus Primary Keys
Dep’t. Supervisor
Is Name No.
assigned
Employee Project
No. No.
works
EMPLOYEE on
PROJECT
Figure 5
Figure 6
Dep’t.
DEPARTMENT Name
Is Employee
assigned Employee No. No.
Dep’t. Name
EMPLOYEE
involves EMPLOYEE
DEPARTMENT
Is Employee
assigned Employee No. No.
Project No.
EMPLOYEE Works
EMPLOYEE
PROJECT on
Husband to wife
ANSWER:
Has wife
HUSBAND WIFE
Has husband
SEATWORK
Draw an ER diagram for the example below. Be sure to
indicate the existence and cardinality for each
relationship.
1. Child to parent
2. Player to team
3. Student to course
Assignment:
Draw an ER diagram for the following. Be sure to
indicate the existence and cardinality for each
relationship.