IS8 (Class 8)
Data Modeling for Database Design:
Entity Relationship Diagrams I (ERDs)
Logical/Conceptual Modeling
Agenda/Learning Objectives
Examine what an Entity-Relationship Data Model (ERD) is.
Learn ERD components.
Learn How a data Model Is Transformed into a Database
Design.
Develop skill with ERDs.
2
Tying It All Together
Business processes (will do later) involve data in motion –
as it moves between actors (one or more of which may be a
computer system/database)
Computer application programs move this data around and
process it according to the needs of each business process
This used to be done by humans
We use BPMN to show how data and human actions flow between
the actors in order to model a business process
3
Tying It All Together
At the same time, organizations collect lots of data, which
most of the time is stored at rest, and is structured
relationally in tables to be accurate and quickly
accessible
We use Entity Relationship Diagrams (ERDs) to model the
structure of data at rest in relational databases
4
Entity Relationship Diagram (ERD) = Blueprint
A commonly-used conceptual model of data requirements
Others exist…
The purpose - identifying and understanding the data
requirements from a business perspective
5
Entity Relationship Diagram (ERD)
Consists of :
1. Entities
2. Relationships
3. Attributes (Fields)
4. Cardinalities
ERD Overview
https://www.youtube.com/watch?v=QpdhBUYk7Kk
6
Entity
The entity (or entity-class) represents a type of object with some common characteristics:
Persons: agency, contractor, customer, department, division, employee, instructor, student, supplier
Places: sales region, building, room, branch office, campus
Objects: book, machine, part, product, raw material, software license, software package, tool, vehicle
model, vehicle
Events: application, award, cancellation, class, flight, invoice, order, registration, renewal, requisition,
reservation, sale, trip
Concepts: account, block of time, bond, course, fund, qualification, stock
We can say that the entities are the “nouns” in our data model
In the ERD we represent each entity by a rectangle with the unique name.
Choose a simple name that makes business sense
Entity names are singular – e.g., “Student” not “Students”
7
Example – Entities in a Hotel Environment
Which entities are important?
Resort
Customer
Employee
Product
What are the products in this
case?
Any other important entity?
8
Resort
Customer
Employee
Product
Relationships
The relationship (or relationship-class) represents how
instances that belong to two or more entities are
associated with each other in the “real-world.”
If entities are the “nouns”, relationships are the “verbs” or verb
phrases…
E.g., An instructor (entity) teaches course (entity) to a student
(entity)
In the ERD – a relationship is often represented by a
straight line connecting two entities.
9
Customer
Example – Relationship
1. A Customer visits a Resort
2. An Employee serves a
Customer
3. A Customer buys a Product
Host
Visits
Supplier
Customer
Can you detect any other
important relationships in this
diagram?
Relationship words should be
shown both ways and NOT
use the same words each way
Employee
10
Purchased by
Pa
Se
ys
rv
,T
es
ips
, is
se
rv
ed
by
Resort
Retailer
Buys
Product
A Fuller Diagram
Resort
Visits
Offer
Employs, Hires
Works at
Employee
Customer
Host
s
Serve
s
,
Pays
tips
Is So
Sells
Is sold by
11
Is purchased by Buys
ld at
Product
Attributes (Fields)
Characteristics of an entity or a relationship
The “data” elements that are important to collect about
instances of entities and relationships
e.g. Student: Student-ID, First Name, Last Name
e.g. Class: Class-Number, Section, Semester, Year
12
Alternative Way to Represent the Entity and Attributes
The primary key is underlined
This nomenclature is easier to
represent and is what will be
used on the exam and in
class.
Student
Student ID#
First Name
Last Name
DOB
13
Customer
Resort
Resort ID#
Resort Name
Address Line 1
City
State
Zip
Employs, Hires
Host
Visits
Off
er
Purchased by Buys
Works at
Employee
Employee ID#
Employee Name
Salary
Position Name
es
v
r
Se
s
Customer ID#
Cust Name
Cust Type
Cust Phone #
Cust Arrival Date
Cust Depart Date
y
Pa
s
p
i
t
s,
Is S
o ld
Sells
Is Sold by
14
at
Product
Product ID#
Item Name
Unit Price
Cardinality
Cardinality – a property of a relationship, the extent/degree of participation
Can an employee be managed by one manager, or by many manager(s)?
Can a sale transaction involve many customers, or only one?
Useful for understanding and defining business rules
Defining constraints on entity-participation in the relationship
MUST capture both the minimum and maximum degree of participation on
each side
e.g., should a student participate at least in one course?
In the ERD – cardinality is represented by using the “crows-foot” notation
< or > 0,1 = Minimum Participation
1, > = Maximum Participation
15
Notation for Cardinalities
Before attempting to establish cardinalities, the identifiers of
the participating entities must be defined
The number of legs (one or many) represents the maximum
cardinality
The vertical line or circle represents the minimum cardinality
Relationships are described by the maximum cardinalities
only
Other conventions for describing cardinalities exist…
16
Cardinality Relations Visualized
17
Representing Cardinalities in ERD
How should we “read” these examples?
Manages
Manager
Is manage by
Department
A manager manages one and only one department, and a department is managed by
one and only one manager
Employee
Works at
Employees/Hires
Resort
An employee works at zero or one resort, and a resort employees one or more employees
Customer
Visits
Is Visited by/Patronized by
Resort
A customer visits one or more resorts, and each resort may have zero or more (zero, one
or many) customers. If zero is minimum and many is maximum, one must be included.
18
Customer
Resort
Resort ID#
Resort Name
Address Line 1
City
Host
Visits
??
State
Zip
Off
ers
es
v
r
Se
??
Customer ID#
Cust Name
Cust Type
Cust Phone #
Cust Arrival Date
Cust Depart Date
Purchased by
Employs, Hires
Works at
Employee
Employee ID#
Employee Name
Salary
Position Name
??
ys
a
P
s
p
i
t
,
Is S
old
at
Sells
Is sold by
??
Buys
Product
Product ID#
Item
Unit Price
19
What cardinalities should be in place where
the red circles exist?
Steps to Building an ERD
Model
Entities &
Attributes
Choose
Primary Keys
Model
Relationships
20
Determine
Cardinalities
Check Model
ERD Review:
ERD Fitness First. In groups of two
fill-in the ERD diagram. Remember:
The number of legs (one or many)
represents the maximum cardinality
The vertical line or circle represents
the minimum cardinality
Relationships are described by the
maximum cardinalities only
21
Develop ERD: Fitness First
David Ernesto, is a recent graduate of Boston University’s Questrom School of Business. He is also a former
varsity tennis player and interested in turning his interest in fitness and athletics into a business. He has
partnered with his former roommate, and together they have rented space in a former warehouse in Allston.
David is convinced that the growing population of young professionals in the area who no longer have
access to their college fitness facilities but who want to stay in shape, represents a great market opportunity.
He has also determined that to be competitive in the fitness business that he has to offer an array of different
classes to attract members. He has begun to hire specialized instructors who will offer classes in yoga,
boxing, cross-fit training and spinning. He and his roommate are interested in tracking which classes are the
most popular and also which clients attend the most classes. He remembers from his IS223 class that he
should develop an E-R diagram as a blueprint for a future database design. He has hired you to do the ERD.
Before you begin, you want to understand his business rules that need to be incorporated:
A fitness class can have one and only one instructor assigned to it.
An instructor teaches at least one class.
A fitness class can be assigned to 1 and only 1 room.
A room can be assigned to one or more fitness class.
Someone does not need to be enrolled in a class to be considered a customer. Anyone can walk in and
want to do one of the fitness classes.
A class exists only if someone takes it.
22
Key Takeaways
ERDs Consist of :
1. Entities
2. Relationships
3. Attributes (Fields)
4. Cardinalities
Apply Concepts to Fitness First Non-Graded Assignment
Due Date on Assignment found on Blackboard in the Class Slides
Folder
23