Copyright (c) 2016 Nenad Jukic and Prospect Press
CHAPTER 2 - Database Requirements and ER Modeling
Database Systems - Introduction to Databases and Data Warehouses
Copyright (c) 2016 Nenad Jukic and Prospect Press
INTRODUCTION
Entity-relationship (ER) modeling - conceptual database modeling technique • Enables the structuring and organizing of the requirements collection
process • Provides a way to graphically represent the requirements
ER diagram (ERD) - the result of ER modeling • Serves as a blueprint for the database
Jukić, Vrbsky, Nestorov – Database Systems Chapter 2 – Slide 2
Copyright (c) 2016 Nenad Jukic and Prospect Press
ENTITIES
Entities - constructs that represent what the database keeps track of • The basic building blocks of an ER diagram • Represent various real world notions, such as people, places, objects,
events, items, and other concepts • Within one ERD each entity must have a different name
Jukić, Vrbsky, Nestorov – Database Systems Chapter 2 – Slide 3
Copyright (c) 2016 Nenad Jukic and Prospect Press
ENTITIES
Two entities
Jukić, Vrbsky, Nestorov – Database Systems Chapter 2 – Slide 4
Copyright (c) 2016 Nenad Jukic and Prospect Press
ENTITIES
Entity instances (entity members) - occurrences of an entity • Entities themselves are depicted in the ER diagrams while entity
instances are not • Entity instances are eventually recorded in the database that is created
based on the ER diagram
Jukić, Vrbsky, Nestorov – Database Systems Chapter 2 – Slide 5
Copyright (c) 2016 Nenad Jukic and Prospect Press
ATTRIBUTES
Attribute - depiction of a characteristic of an entity • Represents the details that will be recorded for each entity instance • Within one entity, each attribute must have a different name
Unique Attribute - attribute whose value is different for each entity instance • Every regular entity must have at least one unique attribute
Jukić, Vrbsky, Nestorov – Database Systems Chapter 2 – Slide 6
Copyright (c) 2016 Nenad Jukic and Prospect Press
ATTRIBUTES
An entity with attributes
Jukić, Vrbsky, Nestorov – Database Systems Chapter 2 – Slide 7
Copyright (c) 2016 Nenad Jukic and Prospect Press
RELATIONSHIPS
Relationship - ER modeling construct depicting how entities are related • Within an ER diagram, each entity must be related to at least one other
entity via a relationship
Jukić, Vrbsky, Nestorov – Database Systems Chapter 2 – Slide 8
Copyright (c) 2016 Nenad Jukic and Prospect Press
RELATIONSHIPS
Cardinality constraints - depict how many instances of one entity can be associated with instances of another entity • Maximum cardinality
o One (represented by a straight bar: I) o Many (represented by a crow’s foot symbol)
• Minimum cardinality (participation) o Optional (represented by a circular symbol: 0) o Mandatory (represented by a straight bar: I)
Jukić, Vrbsky, Nestorov – Database Systems Chapter 2 – Slide 9
Copyright (c) 2016 Nenad Jukic and Prospect Press
RELATIONSHIPS
A relationship between two entities
Jukić, Vrbsky, Nestorov – Database Systems Chapter 2 – Slide 10
Copyright (c) 2016 Nenad Jukic and Prospect Press
RELATIONSHIPS
Four possible cardinality constraints
Jukić, Vrbsky, Nestorov – Database Systems Chapter 2 – Slide 11
Copyright (c) 2016 Nenad Jukic and Prospect Press
RELATIONSHIPS
Several possible versions of the relationship ReportsTo
Jukić, Vrbsky, Nestorov – Database Systems Chapter 2 – Slide 12
Copyright (c) 2016 Nenad Jukic and Prospect Press
RELATIONSHIPS
Types of Relationships (maximum cardinality-wise) • One-to-one relationship (1:1) • One-to-many relationship (1:M) • Many-to-many relationship (M:N)
Jukić, Vrbsky, Nestorov – Database Systems Chapter 2 – Slide 13
Copyright (c) 2016 Nenad Jukic and Prospect Press
RELATIONSHIPS
Three types of relationships (maximum cardinality-wise)
Jukić, Vrbsky, Nestorov – Database Systems Chapter 2 – Slide 14
Copyright (c) 2016 Nenad Jukic and Prospect Press
RELATIONSHIPS
A 1:M Relationship
Jukić, Vrbsky, Nestorov – Database Systems Chapter 2 – Slide 15
A M:N Relationship
A 1:1 Relationship
Copyright (c) 2016 Nenad Jukic and Prospect Press
RELATIONSHIPS
Relationship instances - occurrences of a relationship • Occur when an instance of one entity is related to an instance of
another entity via a relationship • Relationship themselves are depicted in the ER diagrams while
relationship instances are not • Relationship instances are eventually recorded in the database that is
created based on the ER diagram
Jukić, Vrbsky, Nestorov – Database Systems Chapter 2 – Slide 16
Copyright (c) 2016 Nenad Jukic and Prospect Press
RELATIONSHIPS
A relationship and its instances
Jukić, Vrbsky, Nestorov – Database Systems Chapter 2 – Slide 17
Copyright (c) 2016 Nenad Jukic and Prospect Press
RELATIONSHIPS
Relationship attributes • In some cases M:N relationships can actually have attributes of their
own
Jukić, Vrbsky, Nestorov – Database Systems Chapter 2 – Slide 18
Copyright (c) 2016 Nenad Jukic and Prospect Press
RELATIONSHIPS
A M:N relationship with an attribute
Jukić, Vrbsky, Nestorov – Database Systems Chapter 2 – Slide 19
Copyright (c) 2016 Nenad Jukic and Prospect Press
RELATIONSHIPS
A 1:M relationship with and without an attribute
Jukić, Vrbsky, Nestorov – Database Systems Chapter 2 – Slide 20
Copyright (c) 2016 Nenad Jukic and Prospect Press Jukić, Vrbsky, Nestorov – Database Systems Chapter 2 – Slide 21
ER diagram example: ZAGI Retail Company Sales Department Database
Copyright (c) 2016 Nenad Jukic and Prospect Press
ATTRIBUTES
Composite attribute – attribute that is composed of several attributes • Not an additional attribute of an entity • Its purpose is to indicate a situation in which a collection of attributes
has an additional meaning, besides the individual meanings of each attribute
Jukić, Vrbsky, Nestorov – Database Systems Chapter 2 – Slide 22
Copyright (c) 2016 Nenad Jukic and Prospect Press
ATTRIBUTES
An entity with a composite attribute
Jukić, Vrbsky, Nestorov – Database Systems Chapter 2 – Slide 23
Copyright (c) 2016 Nenad Jukic and Prospect Press
ATTRIBUTES
Composite unique attribute – attribute that is composed of several attributes and whose value is different for each entity instance
Jukić, Vrbsky, Nestorov – Database Systems Chapter 2 – Slide 24
Copyright (c) 2016 Nenad Jukic and Prospect Press
ATTRIBUTES
An entity with a unique composite attribute
Jukić, Vrbsky, Nestorov – Database Systems Chapter 2 – Slide 25
Copyright (c) 2016 Nenad Jukic and Prospect Press
ATTRIBUTES
Multiple unique attributes (candidate keys) - when an entity has more than one unique attribute each unique attribute is also called a candidate key
Jukić, Vrbsky, Nestorov – Database Systems Chapter 2 – Slide 26
Copyright (c) 2016 Nenad Jukic and Prospect Press
ATTRIBUTES
An entity with multiple unique attributes (candidate keys)
Jukić, Vrbsky, Nestorov – Database Systems Chapter 2 – Slide 27
Top Related