You are on page 1of 78

Chapter Three

Conceptual
Database Design

1 Fundamentals of Database Systems (INSY2031) - 4/12/2021


chapter 3
Chapter 3 - Objectives
⚫ Database Development Methodology (DDLC)
⚫ Phases of Database Design
⚫ How to use Entity–Relationship (ER) modelling in database design.

⚫ Basic concepts associated with ER model.

⚫ Diagrammatic technique for displaying ER model using Unified


Modelling Language (UML).

⚫ How to identify and resolve problems with ER models- connection traps.

⚫ How to build an E-R model from a requirements specification.

Fundamentals of Database Systems (INSY2031) -


2 chapter 3 4/12/2021
Database Development methodology
⚫ Information System
⚫ Resources that enable collection, management,
control, and dissemination of information throughout
an organization.

⚫ Database is fundamental component of IS, and its


development/usage should be viewed from
perspective of the wider requirements of the
organization.

Fundamentals of Database Systems (INSY2031) -


3 chapter 3 4/12/2021
Database System Development
Life Cycle
⚫ Database planning ( Mission Statement and
Objectives)

⚫ System definition ( Scope and Boundary definition)

⚫ Requirements collection and analysis

⚫ Database design ( Three Phases of Designs)

⚫ DBMS selection (optional)

Fundamentals of Database Systems (INSY2031) -


4 chapter 3 4/12/2021
Database System Development
Lifecycle Cont’d…
⚫ Application design ( Forms, Transactions, Reports…etc)
⚫ Prototyping (optional) Requirements or Evolutionary
Prototype can be adopted
⚫ Implementation (Physical Realization by DDL,DML,
C#,C,C++ ,Java, Delphi…)
⚫ Data conversion and loading ( Legacy Data and
Application Conversion)
⚫ Testing ( to Find Error/Defect in the software)
⚫ Operational maintenance ( Monitoring and maintenance)

Fundamentals of Database Systems (INSY2031) -


5 chapter 3 4/12/2021
Stages of the Database System Development Lifecycle Cont’d…

Fundamentals of Database Systems (INSY2031) -


6 chapter 3 4/12/2021
Database Design Methodology
⚫ Three main phases for Database Design
⚫ Conceptual database design
⚫ Logical database design
⚫ Physical database design

Fundamentals of Database Systems (INSY2031) -


7 chapter 3 4/12/2021
Conceptual Database Design
⚫ The process of constructing a model of the data
used in an enterprise, independent of all
Technical/physical considerations.

Fundamentals of Database Systems (INSY2031) -


8 chapter 3 4/12/2021
Logical Database Design
⚫ The process of constructing a model of the data
used in an enterprise based on a specific data model
(e.g. relational), but independent of a particular
DBMS and other physical considerations.

Fundamentals of Database Systems (INSY2031) -


9 chapter 3 4/12/2021
Physical Database Design
⚫ The process of producing a description of the
implementation of the database on secondary
storage; it describes the base relations, file
organizations, and indexes design used to achieve
efficient access to the data, and any associated
integrity constraints and security measures.

Fundamentals of Database Systems (INSY2031) -


10 chapter 3 4/12/2021
Conceptual Database Design
⚫ Conceptual design revolves around discovering and
analyzing organizational and user data requirements
The important activities are to identify
⚫ Entities
⚫ Attributes
⚫ Relationships
⚫ Constraints
And based on these components develop the E-R model
using
⚫ ER diagrams +Description about the Diagram

Fundamentals of Database Systems (INSY2031) -


11 chapter 3 4/12/2021
Developing an E-R Diagram
⚫ Designing conceptual model: To identify the entities, attributes,
relationships, and constraints on the data,
Different set of methods used during the analysis phase.
⚫ Information gathering
⚫ Interviewing end users individually and /or as a group
⚫ Questionnaire survey
⚫ Direct observation
⚫ Examining different documents like forms, reports, receipts, invoices
etc
⚫ Analysis of requirements gathered (a guideline)
⚫ Nouns --🡪 prospective entities
⚫ Adjectives--🡪prospective attributes
⚫ Verbs/verb phrases--🡪prospective relationships
⚫ Commanding Words--🡪Constraints
Fundamentals of Database Systems (INSY2031) -
12 chapter 3 4/12/2021
Developing an E-R Diagram Cont’d…
⚫ Develop the basic E-R Model ( Using UML/Chen
Notation)
⚫ Check for Redundant Relationships in the ER Diagram.
Relationships between entities indicate access from one
entity to another - this is often referred to as Navigation' of
the ER diagram
⚫ Validate an E-R Model against requirement of the user.
⚫ Present the basic E-R model for review.
⚫ Collect Feedback from the users
Note: The process is repeated until the end users and
designers agree that the E-R diagram is a representation of
the organization’s activities and functions. (Iterative)
Fundamentals of Database Systems (INSY2031) -
13 chapter 3 4/12/2021
ER diagram an Example

Fundamentals of Database Systems (INSY2031) -


14 chapter 3 4/12/2021
Concepts of the ER Model
⚫ Entity types

⚫ Relationship types

⚫ Attributes
⚫ Structural Constraints

Fundamentals of Database Systems (INSY2031) -


15 chapter 3 4/12/2021
Entity Type
⚫ Entity type
⚫ Group of objects with same properties, identified by
enterprise as having an independent existence.

⚫ Entity occurrence
⚫ Uniquely identifiable object of an entity type.

Fundamentals of Database Systems (INSY2031) -


16 chapter 3 4/12/2021
Examples of Entity Types

Fundamentals of Database Systems (INSY2031) -


17 chapter 3 4/12/2021
ER diagram of Staff and Branch entity
types

Fundamentals of Database Systems (INSY2031) -


18 chapter 3 4/12/2021
Relationship Types
⚫ Relationship type
⚫ Set of meaningful associations among entity types.

⚫ Relationship occurrence
⚫ Uniquely identifiable association, which includes one
occurrence from each participating entity type.
⚫ Shown by a Semantic Net an Object Level Model that
shows the relationship instances.

Fundamentals of Database Systems (INSY2031) -


19 chapter 3 4/12/2021
Semantic net of Has relationship type

Fundamentals of Database Systems (INSY2031) -


20 chapter 3 4/12/2021
ER diagram of Branch Has Staff relationship

Fundamentals of Database Systems (INSY2031) -


21 chapter 3 4/12/2021
Relationship Types
⚫ Degree of a Relationship
⚫ Number of participating entities in relationship.

⚫ Relationship of degree :
⚫ One is Unary
⚫ two is binary
⚫ three is ternary
⚫ four is quaternary
⚫ N is n-ary.

Fundamentals of Database Systems (INSY2031) -


22 chapter 3 4/12/2021
Binary relationship called POwns

Fundamentals of Database Systems (INSY2031) -


23 chapter 3 4/12/2021
Ternary relationship called Registers

Fundamentals of Database Systems (INSY2031) -


24 chapter 3 4/12/2021
Quaternary relationship called Arranges

Fundamentals of Database Systems (INSY2031) -


25 chapter 3 4/12/2021
Relationship Types
⚫ Recursive Relationship
⚫ Relationship type where same entity type participates
more than once in different roles.

⚫ Relationships may be given role names to indicate


purpose that each participating entity type plays in
a relationship.

Fundamentals of Database Systems (INSY2031) -


26 chapter 3 4/12/2021
Recursive relationship called Supervises
with role names

Fundamentals of Database Systems (INSY2031) -


27 chapter 3 4/12/2021
Entities associated through two distinct
relationships with role names

Fundamentals of Database Systems (INSY2031) -


28 chapter 3 4/12/2021
Attributes
⚫ Attribute
⚫ Property of an entity or a relationship type.

⚫ Attribute Domain
⚫ Set of allowable values for one or more attributes.

Fundamentals of Database Systems (INSY2031) -


29 chapter 3 4/12/2021
Attributes
⚫ Simple Attribute
⚫ Attribute composed of a single component with an
independent existence.
⚫ Represented by
⚫ an Ellipse in Chen Notation
⚫ A named field in UML

⚫ Composite Attribute
⚫ Attribute composed of multiple components, each with an
independent existence.
⚫ Indicated by indentation in E-R model(UML)
⚫ Indicated by extension ellipses of an attribute ellipse (Chen Notation)

Fundamentals of Database Systems (INSY2031) -


30 chapter 3 4/12/2021
Attributes
⚫ Single-valued Attribute
⚫ Attribute that holds a single value for each occurrence of an
entity type.
⚫ Represented by
⚫ A single line ellipse in Chen Notation
⚫ Named attribute in UML-ER

⚫ Multi-valued Attribute
⚫ Attribute that holds multiple values for each occurrence of an
entity type.
⚫ Represented by
⚫ double line ellipse in Chen Notation
⚫ [Min..Max ] boundary in UML

Fundamentals of Database Systems (INSY2031) -


31 chapter 3 4/12/2021
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 type.
⚫ Represented by
⚫ a dotted line ellipse in traditional
⚫ “/” prefix in UML

Fundamentals of Database Systems (INSY2031) -


32 chapter 3 4/12/2021
Keys
⚫ Candidate Key
⚫ Minimal set of attributes that uniquely identifies each
occurrence of an entity type.

⚫ Primary Key
⚫ Candidate key selected to uniquely identify each occurrence of
an entity type.
⚫ Underlined- Chen Notation
⚫ {Pk} suffix( UML)

⚫ Composite Key
⚫ A candidate key that consists of two or more attributes.
⚫ Underline all (Chen Notation)
⚫ {PK} suffix all (UML)

Fundamentals of Database Systems (INSY2031) -


33 chapter 3 4/12/2021
ER diagram of Staff and Branch
entities and their attributes

Fundamentals of Database Systems (INSY2031) -


34 chapter 3 4/12/2021
Entity Type
⚫ Strong Entity Type
⚫ Entity type that is not existence-dependent on some
other entity type.

⚫ Weak Entity Type


⚫ Entity type that is existence-dependent on some other
entity type.

Fundamentals of Database Systems (INSY2031) -


35 chapter 3 4/12/2021
Strong entity type called Client and
weak entity type called Preference

Fundamentals of Database Systems (INSY2031) -


36 chapter 3 4/12/2021
Relationship called Advertises with attributes

Fundamentals of Database Systems (INSY2031) -


37 chapter 3 4/12/2021
Structural Constraints
⚫ Main type of constraint on relationships is called
multiplicity.

⚫ Multiplicity - number (or range) of possible


occurrences of an entity type that may relate to a
single occurrence of an associated entity type
through a particular relationship.
⚫ Represents policies (called business rules)
established by user or company.

Fundamentals of Database Systems (INSY2031) -


38 chapter 3 4/12/2021
Structural Constraints
⚫ The most common degree for relationships is
binary.

⚫ Binary relationships are generally referred to as


being: ( in terms of Cardinality)
⚫ one-to-one (1:1)
⚫ one-to-many (1:*)
⚫ many-to-many (*:*)

Fundamentals of Database Systems (INSY2031) -


39 chapter 3 4/12/2021
Semantic net of Staff Manages Branch
relationship type

Fundamentals of Database Systems (INSY2031) -


40 chapter 3 4/12/2021
Multiplicity of Staff Manages Branch
(1:1) relationship

Fundamentals of Database Systems (INSY2031) -


41 chapter 3 4/12/2021
Semantic net of Staff Oversees
PropertyForRent relationship type

Fundamentals of Database Systems (INSY2031) -


42 chapter 3 4/12/2021
Multiplicity of Staff Oversees PropertyForRent
(1:*) relationship type

Fundamentals of Database Systems (INSY2031) -


43 chapter 3 4/12/2021
Semantic net of Newspaper Advertises
PropertyForRent relationship type

Fundamentals of Database Systems (INSY2031) -


44 chapter 3 4/12/2021
Multiplicity of Newspaper Advertises
PropertyForRent (*:*) relationship

Fundamentals of Database Systems (INSY2031) -


45 chapter 3 4/12/2021
Structural Constraints for Complex
Relationships
⚫ Multiplicity for Complex Relationships
⚫ Number (or range) of possible occurrences of an
entity type in an n-ary relationship when other (n-1)
values are fixed.

Fundamentals of Database Systems (INSY2031) -


46 chapter 3 4/12/2021
Semantic net of ternary Registers relationship
with values for Staff and Branch entities fixed

Fundamentals of Database Systems (INSY2031) -


47 chapter 3 4/12/2021
Multiplicity of ternary Registers relationship

Fundamentals of Database Systems (INSY2031) -


48 chapter 3 4/12/2021
Summary of multiplicity constraints

Fundamentals of Database Systems (INSY2031) -


49 chapter 3 4/12/2021
Structural Constraints
⚫ Multiplicity is made up of two types of restrictions
on relationships: cardinality and participation.

Fundamentals of Database Systems (INSY2031) -


50 chapter 3 4/12/2021
Structural Constraints

⚫ Cardinality
⚫ Describes maximum number of possible relationship
occurrences for an entity participating in a given
relationship type.
⚫ Participation
⚫ Determines whether all or only some entity occurrences
participate in a relationship.

Fundamentals of Database Systems (INSY2031) -


51 chapter 3 4/12/2021
Multiplicity as cardinality and participation
constraints

Fundamentals of Database Systems (INSY2031) -


52 chapter 3 4/12/2021
Problems with ER Models
⚫ Problems may arise when designing a conceptual
data model called connection traps.

⚫ Often due to a misinterpretation of the meaning of


certain relationships.

⚫ Two main types of connection traps are called fan


traps and chasm traps.

Fundamentals of Database Systems (INSY2031) -


53 chapter 3 4/12/2021
Problems with ER Models
⚫ Fan Trap
⚫ Where a model represents a relationship between entity types,
but pathway between certain entity occurrences is ambiguous.
⚫ Occurs when we have two or more 1..* relationships fanning
out from same entity type
⚫ Chasm Trap
⚫ Where a model suggests the existence of a relationship
between entity types, but pathway does not exist between
certain entity occurrences.
⚫ A chasm trap may occur where there are one or more
relationships with a minimum multiplicity of zero (that is
optional participation) forming part of the pathway between
related entities
Fundamentals of Database Systems (INSY2031) -
54 chapter 3 4/12/2021
An Example of a Fan Trap

This brings Ambiguity on the


information available

Fundamentals of Database Systems (INSY2031) -


55 chapter 3 4/12/2021
Semantic Net of ER Model with Fan
Trap

⚫ At which branch office does staff number SG37


work?

Fundamentals of Database Systems (INSY2031) -


56 chapter 3 4/12/2021
Restructuring ER model to remove Fan
Trap

Fundamentals of Database Systems (INSY2031) -


57 chapter 3 4/12/2021
Semantic Net of Restructured ER
Model with Fan Trap Removed

⚫ SG37 works at branch B003.

Fundamentals of Database Systems (INSY2031) -


58 chapter 3 4/12/2021
An Example of a Chasm Trap

This creates information gap

Fundamentals of Database Systems (INSY2031) -


59 chapter 3 4/12/2021
Semantic Net of ER Model with Chasm
Trap

⚫ At which branch office is property PA14 available?

Fundamentals of Database Systems (INSY2031) -


60 chapter 3 4/12/2021
ER Model restructured to remove Chasm
Trap

Fundamentals of Database Systems (INSY2031) -


61 chapter 3 4/12/2021
Semantic Net of Restructured ER
Model with Chasm Trap Removed

Fundamentals of Database Systems (INSY2031) -


62 chapter 3 4/12/2021
Enhanced Entity-Relationship Model
⚫ Since 1980s there has been an increase in
emergence of new database applications with more
demanding requirements.

⚫ Basic concepts of ER modelling are not sufficient to


represent requirements of newer, more complex
applications.

⚫ Response is development of additional ‘semantic’


modelling concepts.

Fundamentals of Database Systems (INSY2031) -


63 chapter 3 4/12/2021
The Enhanced Entity-Relationship
Model
⚫ Semantic concepts are incorporated into the
original ER model and called the Enhanced Entity-
Relationship (EER) model.

⚫ Examples of additional concept of EER model is


called specialization / generalization.

Fundamentals of Database Systems (INSY2031) -


64 chapter 3 4/12/2021
Specialization / Generalization
⚫ Superclass
⚫ An entity type that includes one or more distinct
subgroupings of its occurrences.

⚫ Subclass
⚫ A distinct subgrouping of occurrences of an entity
type.

Fundamentals of Database Systems (INSY2031) -


65 chapter 3 4/12/2021
Specialization / Generalization
⚫ Superclass/subclass relationship is one-to-
one (1:1).
⚫ Superclass may contain overlapping or
distinct subclasses.
⚫ Not all members of a superclass need to be
a member of a subclass.
⚫ But all Members of a subclass are members
of a superclass
Fundamentals of Database Systems (INSY2031) -
66 chapter 3 4/12/2021
Specialization / Generalization
⚫ Attribute Inheritance
⚫ An entity in a subclass represents same ‘real world’
object as in superclass, and may possess subclass-
specific attributes, as well as those associated with the
superclass.
⚫ Relationship Inheritance
⚫ An Entity in a subclass may inherit the Relationship
that its super class has with other entities

Fundamentals of Database Systems (INSY2031) -


67 chapter 3 4/12/2021
Specialization / Generalization
⚫ Specialization
⚫ Process of maximizing differences between members
of an entity by identifying their distinguishing
characteristics.

⚫ Generalization
⚫ Process of minimizing differences between entities by
identifying their common characteristics.

Fundamentals of Database Systems (INSY2031) -


68 chapter 3 4/12/2021
AllStaff relation holding details of all
staff

Fundamentals of Database Systems (INSY2031) -


69 chapter 3 4/12/2021
Specialization/generalization of Staff entity
into subclasses representing job roles

Fundamentals of Database Systems (INSY2031) -


70 chapter 3 4/12/2021
Specialization/generalization of Staff entity
into job roles and contracts of employment

Fundamentals of Database Systems (INSY2031) -


71 chapter 3 4/12/2021
EER diagram with shared subclass and
subclass with its own subclass

Fundamentals of Database Systems (INSY2031) -


72 chapter 3 4/12/2021
Constraints on Specialization / Generalization

⚫ Two constraints that may apply to a


specialization/generalization:
⚫ participation constraints
⚫ disjoint constraints.

⚫ Participation constraint
⚫ Determines whether every member in superclass
must participate as a member of a subclass.
⚫ May be mandatory or optional.

Fundamentals of Database Systems (INSY2031) -


73 chapter 3 4/12/2021
Constraints on Specialization / Generalization

⚫ Disjoint constraint
⚫ Describes relationship between members of the
subclasses and indicates whether member of a
superclass can be a member of one, or more than one,
subclass.
⚫ May be disjoint or nondisjoint.

Fundamentals of Database Systems (INSY2031) -


74 chapter 3 4/12/2021
Constraints on Specialization /
Generalization
⚫ There are four categories of constraints of
specialization and generalization:
⚫ mandatory and disjoint
⚫ optional and disjoint
⚫ mandatory and nondisjoint
⚫ optional and nondisjoint.

Fundamentals of Database Systems (INSY2031) -


75 chapter 3 4/12/2021
DreamHome worked example - Staff Superclass
with Supervisor and Manager subclasses

Fundamentals of Database Systems (INSY2031) -


76 chapter 3 4/12/2021
DreamHome worked example - Owner Superclass with
PrivateOwner and BusinessOwner subclasses

Fundamentals of Database Systems (INSY2031) -


77 chapter 3 4/12/2021
DreamHome worked example - Person superclass
with Staff, PrivateOwner, and Client subclasses

Fundamentals of Database Systems (INSY2031) -


78 chapter 3 4/12/2021

You might also like