Chapter 7
Chapter 7
Brief Overview
This note covers relational design and was created from a 48-page PDF. It provides a
detailed walk‑through of functional dependencies, lossless decomposition, BCNF, 3NF,
4NF, multivalued dependencies, and temporal database concepts, giving you the tools to
structure and evaluate database schemas effectively.
Key Points
Overview of functional dependencies and their role in schema design.
Techniques for lossless decomposition and achieving BCNF.
Comparison of 3NF, 4NF, and multivalued dependencies.
Introduction to SQL:2011 temporal extensions and their practical implications.
🔄 Decomposition
Goal: Eliminate repetition of information by splitting a relation into smaller
schemas.
Not every decomposition is useful; lossless decompositions are required.
Bad Decomposition Example
Original schema: employee(ID, name, street, city, salary)
Decomposed into:
employee1(ID, name)
employee2(name, street, city, salary)
Illustration
Original Tuple employee1 employee2
(57766, Kim, Main, (57766, Kim) (Kim, Main, Perryridge, 75000
Perryridge, 75000)
(98776, Kim, North, (98776, Kim) (Kim, North, Hampton, 67000)
Hampton, 67000)
Natural join yields four tuples, mixing attributes of the two Kims, thus losing the
association between each ID and its address/salary.
✅ Lossless Decomposition
Definition: For a relation schema R and a decomposition into R and R 1
2
r(R):
ΠR (r); ⋈; ΠR (r); =; r
1
2
Note: The definition assumes attributes on the left side of a functional dependency
cannot be null.
📏 Normalization Theory
Normalization = systematic process of converting schemas into normal forms
that avoid redundancy.
Steps:
1. Test whether a schema is in a desired normal form (e.g., 1NF, 2NF,
3NF, BCNF).
2. If not, decompose it into smaller schemas that satisfy the target
normal form, ensuring the decomposition is lossless.
The primary tool for testing normal forms is the set of functional
dependencies (FDs).
Notational Conventions
Symbol Meaning
α, β Sets of attributes (Greek letters)
R Relation schema (uppercase Roman)
r(R) Relation r with schema R
K Superkey for a schema
r Instance of a relation
Definition (FD):
“For relation r(R), α → β holds iff for all tuples t 1,
t2
in any legal instance, t 1 [α]
=
t [α] implies t [β ] = t [β ] .”
2
1
2
Superkey as FD: K → R .
Example FD on in_dep
dept name → budget (each department has a unique budget).
Composite superkey: ID, dept name → name, salary, building, budget.
Trivial vs. Non‑trivial FDs
Trivial FD: β ⊆ α (e.g., A → A, AB → A).
Non‑trivial FDs convey actual constraints.
Sample Instance (Figure 7.4)
A B C D
a1 b1 c1 d1
a1 b2 c1 d2
a2 b2 c2 d2
a2 b3 c2 d3
a3 b3 c2 d4
Satisfies A → C (all rows with same A share the same C ).
Violates C → A (rows with C = c2 have different A values).
Using FDs for Lossless Decomposition
For schemas R, R , R with R = R ∪ R , the decomposition is lossless if one
1
2
1
2
R1 ∩ R2 → R1
R1 ∩ R2 → R2
decomposition is lossless.
📐 Normal Forms
Binary decomposition (into two schemas) has a simple lossless test; for
multiple schemas the test is more complex.
Multivalued dependencies (covered later) can also guarantee losslessness
even when no FD is present.
BCNF (Boyce–Codd Normal Form)
Definition: A schema R is in BCNF w.r.t. a set of FDs F if for every non‑trivial
FD α → β in F , α is a superkey of R .
+
Observation: Every schema that satisfies BCNF automatically satisfies 3NF, because
BCNF guarantees that any non‑trivial FD has a superkey on the left‑hand side, fulfilling
condition 2.
Design goals (in order of priority): 1️⃣ Achieve BCNF; 2️⃣ Ensure losslessness; 3️⃣
Preserve dependencies.
When the three cannot be satisfied simultaneously, we must decide between a BCNF
design (possible loss of dependency preservation) and a 3NF design (preserves
dependencies).
🔗 Dependency Preservation
Definition (Dependency‑preserving decomposition) – Given a set of FDs F on
schema R and a decomposition R , … , R , let F be the restriction of F to R (all
1
n
i
+
i
i=1
i
i
+
3. Let F = ⋃ F .
′
i
4. If F ′+
= F
+
→ dependency preserving; otherwise, not.
The test is exponential because F
+
can be large.
Sufficient (Easy) Condition
If each FD in the original set F can be verified on one relation of the
decomposition, the decomposition is automatically dependency preserving.
This condition is sufficient but not necessary; some preserving
decompositions fail this simple test.
Efficient Procedural Test (Modified Attribute Closure)
For each FD α → β in F :
1. result ← α
2. Repeat for each relation R in the decomposition: i
result ← result ∪ t
3. Until result stabilizes.
4. If result contains all attributes of β , the FD is preserved.
The decomposition is dependency preserving iff every FD in F passes the above
procedure.
all of R . i
i
🧩
🧩 Multivalued Dependencies (MVD)
Definition (MVD) – For a relation schema R, α →!! → β holds iff for any two tuples
t1 , t2
with t 1 [α]
= t2 [α]
, there exist tuples t 3,
t4 in R such that
t3 [β ] = t1 [β ],;; t4 [β ] = t2 [β ],
The algorithm guarantees losslessness because every step respects the MVD
condition.
Note: PJNF and DKNF are seldom applied in practice because the associated
constraints are difficult to manage and lack sound‑complete inference rules.
🏷
🏷 First Normal Form (1NF)
Definition (1NF) – A relation schema R is in first normal form iff every attribute
domain is atomic (indivisible).
Non‑Atomic Examples
Non‑Atomic Value Reason
Set of names (e.g., {Alice, Bob}) Contains multiple separate items.
Composite attribute address (street, city) Has internal structure.
Multivalued attribute phone_numbers Holds a collection per tuple.
Encoded ID like "CS001" Can be split into department code and
numeric part.
Atomic domain: Single, indivisible values (e.g., integers, single‑word strings).
When an attribute’s domain can be decomposed (e.g., splitting "CS001" into
dept_code and emp_no), the relation violates 1NF and must be rewritten so
each component becomes its own attribute.
Key Insight – Prefer surrogate keys (simple, system‑generated identifiers) that carry
no business meaning, keeping the interpretation of attributes separate from the key.
🗂 First Normal Form Revisited
A domain is atomic when each value is indivisible. The earlier course identifier
example (CS‑101) is treated as atomic by the database as long as the
application does not split it into department and number parts.
Set‑valued attributes (e.g., a list of section IDs stored with each instructor)
introduce redundant storage and can lead to inconsistencies when updates
are performed in only one place.
Definition (1NF) – A relation schema R is in first normal form iff every attribute
domain is atomic.
🌐 Universal‑Relation Approach
Assumes a single relation with all attributes of interest, defining the complete
view of the database.
Limitation:
Difficult to associate dependent data correctly (e.g., a takes record
cannot be tied to the appropriate course title without additional
logic).
Lacks temporal semantics and other advanced constraints unless
explicitly added.
Modern SQL standards (SQL:2011) introduce temporal extensions to
overcome some of these shortcomings.
ensuring no two rows for the same course_id have overlapping validity periods.
Temporal foreign‑key constraints (theoretically) allow a period to be
specified on both referencing and referenced attributes, but no major DBMS
currently enforces them.
DBMS Support Overview
DBMS Temporal Primary‑Key Temporal Foreign‑Key
Support Support
IBM DB2 ✔︎ ✖︎
📌 Key Takeaways
Avoid embedding business semantics in primary keys; use surrogate keys to
keep data and logic separate.
First normal form is a baseline; modern systems may store non‑atomic values
when they simplify application code, but designers must manage the associated
redundancy.
The database‑design process moves from high‑level E‑R models to
normalized relational schemas, with optional denormalization for performance.
Functional and multivalued dependencies guide refinement of E‑R diagrams;
most many‑to‑many relationships naturally lead to 4NF‑compliant designs.
Temporal extensions (SQL:2011) add validity intervals and enable temporal
keys, though full support varies across DBMSs.
Understanding the algebraic semantics of temporal operations (selection,
projection, join) is essential for designing correct temporal queries.