Overview of
Database Design
v Requirements Analysis:
Understand what data will be
stored in the database, and the
operations it will be subject to.
v Conceptual Design: (ER
v What
v What
vA
v Can
Overview of
Database Design
(cont.)
v Schema Refinement:
(Normalization) Check
relational schema for
redundancies and anomalies.
v Physical Database Design
and Tuning: Consider typical
workloads and further refinement
of the database design (v.g. build
indices).
v Application and Security
Design: Consider aspects of the
application beyond data.
Methodologies like UML often
used for addressing the complete
software development cycle.
ER Model Basics
attributes.
v Entity Set: A collection of
v Each
v Each
ER Model Basics
(Contd.)
Key Constraints
(a.k.a. Cardinality)
Key Constraints
(ternary
relationships)
Participation
Constraints
v Does every department have a
manager?
v If so, this is a participation
constraint: the participation of
Departments in Manages is said to
be total (vs. partial).
Weak Entities
v A weak entity can be identified
uniquely only by considering the
primary key of another (owner)
entity.
v Owner entity set and weak entity set
must participate in a one-to-many
relationship set (one owner, many
weak entities).
v Weak entity sets must have total
participation in this identifying
relationship set.
v transac# is a discriminator within
a group of transactions in an ATM.
ISA (`is a)
Hierarchies
v Overlap constraints: Can Joe be an
Hourly_Emps as well as a
Contract_Emps entity? if so, specify =>
Hourly_Emps OVERLAPS
Contract_Emps.
Aggregation
v Used when we have to model a
relationship involving (entity sets
and) a relationship set.
Conceptual Design
Using the ER Model
v Design choices:
v Should
a concept be modeled
as an entity or an attribute?
v Should
a concept be modeled
as an entity or a relationship?
v Identifying
relationships:
Binary or ternary?
Aggregation?
v But
attribute of Employees or an
entity (connected to
Employees by a
relationship)?
v Depends upon the use we
If we have several
addresses per employee,
address must be an entity
(since attributes cannot be
set-valued).
allow an
employee to work in a department
for two or more periods (a relationship
is identified by participating entities).
Entity vs.
Relationship
v First ER diagram OK if a manager
gets a separate discretionary
budget for each dept.
v What if a manager gets a
discretionary budget that
covers
all managed depts?
v Redundancy: dbudget stored for
each dept managed by manager.
v Misleading: Suggests dbudget
associated with department-mgr
combination.
S can-supply P, D
needs P, and D dealswith S, all these do not imply
that D has agreed to buy P
from S (because D could buy P
from another supplier).
Summary of
Conceptual Design
requirements analysis,
v Yields
a high-level description
of data to be stored
conceptual design
v Constructs
are expressive,
close to the way people think
about their applications.
variations on ER model.
Summary of ER
(Contd.)
v Several kinds of integrity
constraints can be
expressed in the ER model:
key constraints,
participation constraints,
and overlap/covering
constraints for ISA
hierarchies. Some foreign
key constraints are also
implicit in the definition of a
relationship set.
v Some
constraints (notably,
functional dependencies)
cannot be expressed in the ER
model.
v Constraints
play an important
role in determining the best
database design for an
enterprise.
Summary of ER
(Contd.)
v ER design is subjective.
v Entity