Database Management - Session 3
Database Management - Session 3
Management
DATABASE DESIGN AND ER
MODELING
Overview of Database Design Process
Conceptual Data Model
Data Modeling and SDLC
The Conceptual Data Modeling Process
Overview of Database Design Process
ER Model Concepts
Contents
Types of Attributes (1)
Entity Types and Key Attributes (1)
Recursive Relationship Type
Cardinalities in Relationships
Conceptual Data Modeling and the E-R Model
References
Overview of Database Design Process
Two main activities:
◦ Database design
◦ Applications design
Conceptual database design
◦ To design the conceptual schema for a database
application
Applications design focuses on the programs and
interfaces that access the database
◦ Generally considered part of software engineering
Conceptual Data Model
➢Detailed data model that captures the overall
structure of data in an organization
➢Independent of any DBMS or other
implementation considerations
Data Modeling and SDLC
The Conceptual Data Modeling
Process
■Develop a data model for the current system.
■Develop a new conceptual data model that
includes all requirements of the new system.
■Develop an ER model with attributes in the
Analysis phase
■The conceptual data model is translated into a
logical data model and physical design in the
Design phase
Each key is underlined (Note: this is different from the relational schema
where only one “primary key is underlined).
Value Sets (Domains) of
Attributes
Each simple attribute is associated with a value set
◦ E.g., Lastname has a value which is a character string of
upto 15 characters, say
◦ Date has a value consisting of MM-DD-YYYY where each
letter is an integer
A value set specifies the set of values associated
with an attribute
Entity Type CAR with two keys and a
corresponding Entity Set
Initial Design of Entity Types:
EMPLOYEE, DEPARTMENT, PROJECT, DEPENDENT
Refining the COMPANY database schema by
introducing relationships
By examining the requirements, six relationship types are
identified
All are binary relationships( degree 2)
Listed below with their participating entity types:
◦ WORKS_FOR (between EMPLOYEE, DEPARTMENT)
◦ MANAGES (also between EMPLOYEE, DEPARTMENT)
◦ CONTROLS (between DEPARTMENT, PROJECT)
◦ WORKS_ON (between EMPLOYEE, PROJECT)
◦ SUPERVISION (between EMPLOYEE (as subordinate),
EMPLOYEE (as supervisor))
◦ DEPENDENTS_OF (between EMPLOYEE, DEPENDENT)
ER DIAGRAM – Relationship Types are:
WORKS_FOR, MANAGES, WORKS_ON, CONTROLS, SUPERVISION, DEPENDENTS_OF
Constraints on Relationships
Constraints on Relationship Types
◦ (Also known as ratio constraints)
◦ Cardinality Ratio (specifies maximum participation)
◦ One-to-one (1:1)
◦ One-to-many (1:N) or Many-to-one (N:1)
◦ Many-to-many (M:N)
◦ Existence Dependency Constraint (specifies minimum
participation) (also called participation constraint)
◦ zero (optional participation, not existence-dependent)
◦ one or more (mandatory participation, existence-dependent)
Many-to-one (N:1) Relationship
Many-to-many (M:N) Relationship
Recursive Relationship Type
A relationship type between the same participating entity type in
distinct roles
Also called a self-referencing relationship type.
Example: the SUPERVISION relationship
EMPLOYEE participates twice in two distinct roles:
◦ supervisor (or boss) role
◦ supervisee (or subordinate) role
Each relationship instance relates two distinct EMPLOYEE entities:
◦ One employee in supervisor role
◦ One employee in supervisee role
Displaying a recursive relationship
In a recursive relationship type.
◦ Both participations are same entity type in
different roles.
◦ For example, SUPERVISION relationships
between EMPLOYEE (in role of supervisor or
boss) and (another) EMPLOYEE (in role of
subordinate or worker).
In following figure, first role participation labeled with 1 and second role
participation labeled with 2.
In ER diagram, need to display role names to distinguish participations.
Slide 3- 26
A Recursive Relationship Supervision`
Recursive Relationship Type is: SUPERVISION
(participation role names are shown)
Introduction to Entity-
Relationship (E-R) Modeling
Binary relationships
FIGURE 8-11
Examples of relationships of different
Ternary relationships degrees
39
Data Modeling
Data Modeling is a creative, dynamic and evolving
process for:
◦ Exploring the different ways that entities can
relate to each other as they would in the real
world
◦ Recording or drawing entities as they would
behave in a business environment
40
Data Modeling Notations:
A set of symbols used to
construct the ERD
There are many different
notations available but they
all communicate the same
idea
We will follow Barker’s
notation in this course
41
The Entity Relationship (E-R)
Model:
◦ Is a diagramming technique best known as ERD
◦ Is a series of Diagrams listing entities (with
attributes) and the relationships between
entities
◦ Is subject to many variations of representing
entities and relationships
42
The Entity Relationship (E-R)
Model:
An entity is drawn as a
rounded rectangle
Entity’s name appears singular - at
top - in capital letters
Entity’s attributes are
shown below its Name
The primary key attribute is
indicated by a solid underline
43
Relationships:
• The process of connecting any two entities in a
data model.
• The Associations between entities to enforce
Business Rules or Organizational Policies
• Different kinds:
◦ Binary relationships
◦ Unary relationships
◦ Ternary relationships
44
Binary Relationships
45
Relationships
▪ 1-1 (1:1)
▪ A single occurrence of one entity type can be associated with a
single occurrence of the other entity type and vice versa
▪ 1-M or M-1 (1:M, M:1)
▪ Use “Barker’s Notation” to represent the multiple association
▪ “many” = the maximum number of occurrences that can be
involved; means a number that can be: 1,2...N
▪ Sometimes the “M” can be represented by “N”
▪ M-N (M:N)
▪ “many” can be either an exact number or have a known
maximum
▪ Sometimes the “M” can be represented by “N”
46
C.Cardinality in Relationships:
47
Ordinality in Relationships
▪Ordinality ( = Modality = Optionality )
▪ The minimum number of entity occurrences that can be
involved in a relationship.
▪ “inner” symbol on E-R diagram
▪Mandatory relationship: each instance from an entity
must be related to another instance.
▪ Represented by a straight line
▪Optional Relationship each instance from an entity may be
related to another instance
▪ Represented by a dashed line
48
C.Cardinality and Ordinality in
Relationships:
▪ Ordinality is closely coupled with Cardinality.
▪ While Cardinality specifies the occurrences of a
relationship, Ordinality describes the relationship as
either mandatory or optional.
▪ Cardinality specifies the maximum number of
occurrences.
▪ Ordinality specifies the absolute minimum number of
occurrences.
▪ When the minimum number is zero, the relationship is
usually called optional and when the minimum
number is one or more, the relationship is usually
called mandatory.
49
Relationships: One to many
50
Relationships: many to many
51
C.Relationships: one to one –
in action:
52
Relationships Explained
53
References
1. Fundamentals of Database Systems, Seventh
Edition, Elmasri and Navathe(Copyright@ 2017)
2. Modern Systems Analysis and Design, Seventh
Edition. Jeffrey A. Hoffer Joey F. George Joseph
S. Valacich, Chap 8