You are on page 1of 3

10/4/2018

Relationships
• Association / Connections between entities
• Participants are entities that participate in a relationship
• Relationships between entities always operate in both
RELATIONSHIPS directions, i.e. bidirectional
• Relationship features:
 Cardinality, also called multiplicity (number of occurrences of the
Bamweyana Ivan entities participating in a relationship)
 Degree of relationship (how many entities are involved in a
LSG 2102 relationship)

Relationship : Cardinality (Multiplicity) One to one (1:1)


• Cardinality expresses the minimum and maximum • A staff member can be the manager for at most one
number of entity occurrences associated with one cinema and a cinema can have at most one manager
occurrence of the related entity;
• Minimum cardinality: minimum number of entity instances
that must participate in a relationship
• Maximum cardinality:……..
1 1
• Four types:
• One-to-one (1:1)
• One-to-Many (1:M or 1:N)
• Many-to-one (M:1)
Staff Manages
Cinema
• Many-to-Many (N:M or M:N)

One to Many (1:N or 1:M) Many to one (M:1 or N:1)


• Each cinema can have many screens • You can have many subways in a suburb but a subway
can’t be in two suburbs at the same time

1 M

Cinema Has Screen 1


M

Located
Subway in Suburb

1
10/4/2018

Many to Many (M:M or N:N) Many to Many (M:N or N:M)


• Each author may have many books and each book may • An actor may be cast in many films and a film may have
have several authors more than one actor

M N M N

Author Writes
Book Actor Cast Film

Relationships: Participation
Participation
• If every occurrence of “A” needs to participate in the • Optional (partial) participation
relationship it is called mandatory participation. • One entity occurrence does not require corresponding entity
occurrence in particular relationship
• If not every occurrence of “B”… it is called optional
• Participation represents in a single line
participation.
• Mandatory (total) participation
• One entity occurrence requires corresponding entity occurrence in
particular relationship
• Participation represented in a double line
• Entity Relationship Diagram

A Relationship
B

Relationships: Degree Recursive Relationship


• Degree of relationship indicates the number of entities or
participants associated with a relationship • The entity has a relationship with itself.
• The same entity participates more than once in a relationship
• Three types:
• E.g. an employee reports to an employee
 Unary (association is maintained within single entity) – see
recursive relationship
 Binary (two entities are associated)
 Ternary (three entities are associated)

1
Employee Reports
1

2
10/4/2018

Example: Ternary Multiple Relationships; same entities


• A pair of entities can have more than one relationship
linking them
• There may be different cardinalities and different
participation for each relationships

Alternate Relationship Denotations Home work 1


• You will see variations on the ERD style used
• Identify type of cardinality constraint
(Relationship) for following:
• Many facilities belong to a forest. Each
facility belong to one forest.
• A manager manages 1 forest. Each forest
has 1 manager.
• A river supplies water to many facilities. A
• You may come across other tools, too
facility gets water from many rivers.
• e.g. UML (Unified Modelling Language)

Home work 2 LINK


• A staff member may be a manager at one cinema but not • http://wofford-ecs.org/dataandvisualization/ermodel/material.htm

all staff will need to manage a cinema (projectionist, ticket • http://rdbms.opengrass.net/2_Database%20Design/2.2_Normalisation/2.


salesperson, etc…) while a cinema must have at most 2.1_Normalisation%20Overview.html
one cinema manager
• Sketch the above relationship

You might also like