Lecture 3
Lecture 3
Lecture 3
Database Modelling
Objectives
Entity
Relationship
Entity
A set of objects with the same
properties, which are identified by a
user or organization as having an
independent existence.
Entity occurrence
Each uniquely identifiable object within
a set.
Entities with physical and conceptual existence
ER diagram of entities
Relationships
• Relationship
A set of meaningful associations among
entities.
• Relationship occurrence
Each uniquely identifiable association
within a set.
ER diagram of relationships
Relationships
Degree of a relationship
• Number of participating entities in
relationship.
Relationship of degree :
• two is binary
• three is ternary
• four is quaternary.
Binary relationship called POwns
Example of ternary relationship
Quaternary relationship called Arranges
Recursive relationships
• Simple attribute
Attribute composed of a single
component with an independent
existence.
• Composite attribute
Attribute composed of multiple
components, each with an independent
existence.
Attributes
• Single-valued attribute
Attribute that holds a single
value for an entity occurrence.
• Multi-valued attribute
Attribute that holds multiple
values for an entity occurrence.
Attributes
• Derived attribute
Attribute that represents a value
that is derivable from value of a
related attribute, or set of
attributes, not necessarily in
the same entity.
ER diagram of entities and their attributes
Strong and weak entities
• Strong entity
Entity that is not dependent on the
existence of another entity for its
primary key.
• Weak entity
Entity that is partially or wholly
dependent on the existence of another
entity, or entities, for its primary
key.
Strong entity type called Client and weak
entity type called Preference
Multiplicity constraints on relationships
• Cardinality
Describes the number of possible
relationships for each participating
entity.
• Participation
Determines whether all or only some
entity occurrences participate in a
relationship.
Multiplicity as cardinality and participation constraints
Relationship with attributes
Problems with ER models
• Fan trap
Two entities have a 1:*
relationship that fan out from a
third entity, but the two entities
should have a direct relationship
between them to provide the
necessary information.
An example of a fan trap
Fan trap
– individual example
52
Restructuring ER model to remove Fan
Trap
Fan trap resolved – individual
example
54
Problems with ER models
• Chasm trap
A model suggests the existence of a
relationship between entities, but
the pathway does not exist between
certain entity occurrences.
An example of a chasm trap
Chasm trap
– individual example
57
Resolving the chasm trap
Chasm trap resolved – individual
example
DFD –
Data
Flow
Diagram
60