Chapter 4 - ER Model
Chapter 4 - ER Model
Chapter 4
High-level Database Models - ER model
Objectives
5 Know what are Entity, Entity Set, Entity Instances, Attributes & others
4 ERD
5 Attributes on Relationships
6 Weak Entities
7 Sub-class
Data Model
The ANSI-SPARC
Architecture (American
National Standards Institute,
Standards Planning And
Requirements Committee), is
an abstract design standard
for a database management
system (DBMS), first
proposed in 1975.
Data Model
ERD -
Entity
Relationship
Diagram
Steps in Database Design
4.1. Entity Relationship Model
1. Entity sets
2. Attributes
3. Relationships
4.1. Entity Relationship Model
https://creately.com
4.1. Entity Relationship Model
3 types of shape:
- Rectangle
- Diamond
- Ellipse/Oval
Determine:
1. Entity Sets
2. Attributes
3. Relationships
https://creately.com
4.1. Entity Relationship Model
1. Entity Sets:
Shopper
Item
2. Attributes:
item_type
item_price
item_source
3. Relationships:
Buys
https://creately.com
4.1. ERD - Notation
4.1.1 ERD - Entity sets
Entity:
Can be a person, place, event, or object that is
relevant to a given system
Named using singular nouns
A collection of similar entities forms an entity set
Weak entity:
Is an entity that depends on the existence of
another entity
Uses a foreign key combined with its attributed to form
the primary key
ODER and ORDER_ITEM
https://creately.com
4.1.1 ERD - Entity sets
Entity:
Can be a person, place, event, or object that is
relevant to a given system
Named using singular nouns
A collection of similar entities forms an entity set
Weak entity:
Is an entity that depends on the existence of
another entity
Uses a foreign key combined with its attributed to form
the primary key
https://creately.com
4.1.1 ERD - Entity sets
A specific example of an entity is called an entity
instance
Instances Entities
A B
PERSON Bill Clinton, Obama
PRODUCT Chair, Table, Motor
JOB Violinist, Programmer
SKILL LEVEL Fluent
https://creately.com
4.1.1 ERD - Entity sets
Entities Instances
PERSON Bill Clinton, Obama
PRODUCT Chair, Table, Motor
JOB Violinist, Programmer
SKILL LEVEL Fluent
https://creately.com
4.1.2 ERD - Attributes
Attributes are properties or characteristics of
an entity, relationship, or another attribute
https://creately.com
4.1.2 ERD - Attributes
No. City
Street
4.1.2 ERD - Attributes
Attributes are properties or characteristics
of an entity, relationship, or another
attribute
Exp:
4.1.3 ERD - Relationships
Recursive Relationships:
If the same entity participates more than once in
a relationship it is known as a recursive relationship
4.1.3 ERD - Relationships
Multiplicity of Binary E/R Relationships
(Cardinality and Ordinality)
4.1.3 ERD - Relationships
Multiplicity of Binary E/R Relationships
(Cardinality and Ordinality)
4.1.3 ERD - Relationships
Roles in Relationships:
One entity set appears two or more times in a single
relationship → each relationship line has a different role
4.1.4 Subclasses
A certain special-case entity sets, each with its
own special attributes and/or relationships
Using a relationship called isa (“an A is a B”)
4.1.4 Subclasses
Exp: Among the special kinds of movies are cartoons
and murder mysteries (with some special properties)
4.1.5 Comparision of ERD notation
Summary
Database design process has …A… phases: …B……..
E/R model has used in …C… phase to …D… of applications.
Main concepts in E/R model are: …E..
Relationship Cardinality: …F…
Others concepts are: weak entity, multi-way relationship, sub-
class
Summary
Chapter 4
High-level Design Principles
& convert E/R diagram to relational model
Objectives
1 Design Principles
Faithfulness
Avoiding Redundancy
Simplicity Counts
Choosing the Right Relationships
Picking the Right Kind of Element
Limit the use of weak entity sets.
Don’t use an entity set when an attribute will do.
4.2.1. Faithfulness
Data inconsistency
4.2.2. Avoiding Redundancy
An update anomoly potential
Two representations of the same fact become
inconsistent if we change one and forget to change
the other.
Recall anomalies due to FD’s.
Data inconsistency
The same data exists in different formats in
multiple tables
This can cause unreliable and meaningless
information
4.2.2. Avoiding Redundancy - Exp
manf
Problem
4.2.2. Avoiding Redundancy - Exp
Studios Owns
Example: A poor design with
an Un-necessary entity set
That diagram truly represents the real world, since it is
possible to go from a movie to its unique owning
studio via Holdings, however, Holdings serves no
useful purpose and we are better off without it. It
makes programs that use the Movie-Studio relationship
more complicated, waste space and encourages errors
Studios Owns
Example: A poor design with
an Un-necessary entity set
Studios Owns
deletion anomalies
4.2.4. Choosing
the Right Relationships
Salary
title year name addr
Salary
title year name addr
length genre
Studios
name addr
name name
name name
Beers
Since the Manfs has
•only one attribute (key),
•and only the “one” at end the relationship.
M:M
coursera
4.3. From E/R diagrams
to Relational Designs
coursera
Convert one-many relationship
1:M
coursera
4.3. From E/R diagrams
to Relational Designs
coursera
Convert multi-way relationship