Professional Documents
Culture Documents
DD s03 l01 PDF
DD s03 l01 PDF
Identifying Relationships
Identifying Relationships
Identifying Relationships
Tell Me / Show Me
Relationships in Families
What is the relationship between you and your aunt, you and
your uncle, your cousins, your grandmother, etc? What would a
society be like that did not categorize relatives as aunts, uncles,
cousins, grandmothers and grandfathers but only by their name?
How could you tell someone that Jenny was your cousin?
It would be a long and potentially confusing introduction, like
This is Jenny, who is the child of the woman who has the same
parents as my parent who is a woman, as opposed to This is
Jenny, my mothers sisters child, or This is Jenny, my aunts
child, or the simplest one This is Jenny, my cousin.
Identifying Relationships
Tell Me / Show Me
Relationships in Data Models
Relationships:
Represent something of significance/importance to the
business
Show how entities are related to each other
Always exist between two entities (or one entity twice)
Always have two sides
Are named at both ends
Have an optionality
Have a degree or cardinality
Identifying Relationships
Tell Me / Show Me
What is Optionality in a Relationship?
Relationships are either mandatory or optional. Based on what you
know about instances of the entities, you can determine optionality
by answering four questions:
Must every employee have a job? In other words, is this a
mandatory or optional relationship for an employee?
Can employees have more than one job?
Must every job be done by an employee? (In other words, is this
a mandatory or optional relationship for a job?)
Can each job be done by more than one employee?
Identifying Relationships
Tell Me / Show Me
What is Cardinality in a Relationship?
Cardinality of a relationship determines the degree of a
relationship. It answers how many.
For example:
Identifying Relationships
Tell Me / Show Me
Optionality and Cardinality
Examples:
Each EMPLOYEE must hold one and only one JOB
Each JOB may be held by one or more EMPLOYEEs
Identifying Relationships
Tell Me / Show Me
Relationships
PASSENGER purchases or
books a SEAT
SEAT
PASSENGER
Identifying Relationships
Tell Me / Show Me
Business Scenario 1
What are the relationships in the
following business scenario?
We like to classify all our music, each
song or soundtrack, by type. The
different types are rock, jazz, country,
classical, pop, new age, etc. We can
add new types as the need arises. In
fact, we recently added a new type for
rap music. We realize that a song can
really be classified under more than one
type, but for our purposes we select
only one main classification type for
each song."
RELATIONSHIP
SONG
(music/soundtrack) is
classified by TYPE
TYPE is a classification
for SONG
10
Identifying Relationships
Tell Me / Show Me
Business Scenario 1
(continued)
SONG has a TYPE: optionality
and cardinality
SONG
Stairway to Heaven
TYPE
rock
jazz
new age
classical
pop
Minute Waltz
Pachelbel Canon
Thriller
Stand By Your Man
country
11
Identifying Relationships
Tell Me / Show Me
SONG
Business Scenario 1
(continued)
TYPE
Stairway to Heaven
rock
jazz
new age
classical
pop
country
Minute Waltz
Pachelbel Canon
Thriller
Stand By Your Man
Amazing
Grace
12
Identifying Relationships
Tell Me / Show Me
SONG
Business Scenario 1
(continued)
TYPE
Stairway to Heaven
Green Dolphin Street
rock
jazz
new age
classical
pop
Minute Waltz
Pachelbel Canon
Thriller
Stand By Your Man
country
13
Identifying Relationships
Tell Me / Show Me
Business Scenario 1
(continued)
SONG has a TYPE
SONG
TYPE
Stairway to Heaven
Green Dolphin Street
rock
jazz
new age
classical
pop
Minute Waltz
Pachelbel Canon
Thriller
Stand By Your Man
country
14
Identifying Relationships
Tell Me / Show Me
Business Scenario 2
What are the relationships in the
following business scenario?
RELATIONSHIP
CUSTOMER places
ORDERS
An ORDER is placed
by one CUSTOMER
15
Identifying Relationships
Tell Me / Show Me
CUSTOMER
Business Scenario 2
(continued)
Linda
Krishna
Mel
ORDER
Order No. 100
-French fries
- Large soda
Order No. 102
- Apple pie
Order No. 77
-Hamburger
- Salad
- Fruit cup
Order No. 10
-Vegetarian platter
- Orange juice
16
Identifying Relationships
Tell Me / Show Me
Business Scenario 3
A relationship can relate an
entity to itself. Examine the
following scenario.
We need to keep track of our
employees and their
managers. Every employee
has one manager, including
the managing director, who
manages him/herself. Each
manager can manage several
employees.
Since managers are also
employees, there is only one
entity here: EMPLOYEE.
RELATIONSHIP
An EMPLOYEE manages EMPLOYEEs
An EMPLOYEE is managed by one EMPLOYEE
17
Identifying Relationships
Tell Me / Show Me
Terminology
Key terms used in this lesson include:
Cardinality/Degree
Relationship
Optionality
18
Identifying Relationships
Summary
Objectives Summarized
In this lesson, you have learned how to:
Interpret and describe relationship optionality
Interpret and describe relationship cardinality
Relate entities by applying the rules of cardinality and
optionality
19
Identifying Relationships
Summary
Practice Guide
The link for the lesson practice guide can be found in the
course resources in Section 0.
20