0% found this document useful (0 votes)
6 views

Normalization

The document outlines the principles of database design, focusing on normalization theory as a formal method to create efficient databases. It discusses the importance of avoiding modification anomalies and ensuring lossless decomposition while preserving functional dependencies. Additionally, it introduces functional dependencies, Armstrong's axioms, and various normal forms that dictate the quality of database designs.

Uploaded by

1none2none3
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Normalization

The document outlines the principles of database design, focusing on normalization theory as a formal method to create efficient databases. It discusses the importance of avoiding modification anomalies and ensuring lossless decomposition while preserving functional dependencies. Additionally, it introduces functional dependencies, Armstrong's axioms, and various normal forms that dictate the quality of database designs.

Uploaded by

1none2none3
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 115

CS315: DATABASE S YSTEMS

N ORMALIZATION T HEORY

Arnab Bhattacharya
[email protected]

Computer Science and Engineering,


Indian Institute of Technology, Kanpur
http://web.cse.iitk.ac.in/˜cs315/

2nd semester, 2024-25


Tue, Wed 12:00-13:15

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 1 / 31


Database Design
Central question: how to design a “good” database?

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 2 / 31


Database Design
Central question: how to design a “good” database?
Two ways of answering it: informally and formally

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 2 / 31


Database Design
Central question: how to design a “good” database?
Two ways of answering it: informally and formally
Informal
Schemas should represent distinct entities
Little or no redundancy in storage
No modification anomaly
Less number of or no null values
No spurious tuple

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 2 / 31


Database Design
Central question: how to design a “good” database?
Two ways of answering it: informally and formally
Informal
Schemas should represent distinct entities
Little or no redundancy in storage
No modification anomaly
Less number of or no null values
No spurious tuple
Formally: Normalization theory

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 2 / 31


Modification Anomaly
Consider the following schema: (roll, name, courseid, title)

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 3 / 31


Modification Anomaly
Consider the following schema: (roll, name, courseid, title)
Update anomaly
Changing title of a course causes updates to many students

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 3 / 31


Modification Anomaly
Consider the following schema: (roll, name, courseid, title)
Update anomaly
Changing title of a course causes updates to many students
Insert anomaly
Admitting a student immediately requires a course and vice versa

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 3 / 31


Modification Anomaly
Consider the following schema: (roll, name, courseid, title)
Update anomaly
Changing title of a course causes updates to many students
Insert anomaly
Admitting a student immediately requires a course and vice versa
Delete anomaly
Deleting a course may delete all the corresponding students

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 3 / 31


Modification Anomaly
Consider the following schema: (roll, name, courseid, title)
Update anomaly
Changing title of a course causes updates to many students
Insert anomaly
Admitting a student immediately requires a course and vice versa
Delete anomaly
Deleting a course may delete all the corresponding students
Thus, a bad design

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 3 / 31


Lossless Decomposition
Must preserve losslessness of the corresponding (natural) join
Lossy decomposition
roll name batch
1 AB 2011
Suppose is decomposed into
2 AB 2012
3 CD 2014
roll name name batch
1 AB AB 2011
and
2 AB AB 2012
3 CD CD 2014

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 4 / 31


Lossless Decomposition
Must preserve losslessness of the corresponding (natural) join
Lossy decomposition
roll name batch
1 AB 2011
Suppose is decomposed into
2 AB 2012
3 CD 2014
roll name name batch
1 AB AB 2011
and whose join produces
2 AB AB 2012
3 CD CD 2014
roll name batch
1 AB 2011
1 AB 2012
with two spurious tuples
2 AB 2011
2 AB 2012
3 CD 2014
Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 4 / 31
Lossless Decomposition
Lossless decomposition
roll name batch
1 AB 2011
Suppose is decomposed into
2 AB 2012
3 CD 2014
roll name roll batch
1 AB 1 2011
and
2 AB 2 2012
3 CD 3 2014

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 5 / 31


Lossless Decomposition
Lossless decomposition
roll name batch
1 AB 2011
Suppose is decomposed into
2 AB 2012
3 CD 2014
roll name roll batch
1 AB 1 2011
and whose join produces
2 AB 2 2012
3 CD 3 2014
roll name batch
1 AB 2011
with no loss
2 AB 2012
3 CD 2014

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 5 / 31


Lossless Decomposition
Lossless decomposition
roll name batch
1 AB 2011
Suppose is decomposed into
2 AB 2012
3 CD 2014
roll name roll batch
1 AB 1 2011
and whose join produces
2 AB 2 2012
3 CD 3 2014
roll name batch
1 AB 2011
with no loss
2 AB 2012
3 CD 2014
Preserve functional dependencies

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 5 / 31


Functional Dependencies
Functional dependencies (FDs) are constraints derived from the
meaning of and relationships among attributes
A set of attributes X functionally determines Y , denoted by
X → Y , if the value of X determines a unique value of Y
roll → name; roll → batch
For any two tuples t1 and t2 in any legal instance of r (R), if
t1 .X = t2 .X then t1 .Y = t2 .Y
A FD X → Y is trivial if it is satisfied for all instances of a relation
Y ⊆X

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 6 / 31


Functional Dependencies
Functional dependencies (FDs) are constraints derived from the
meaning of and relationships among attributes
A set of attributes X functionally determines Y , denoted by
X → Y , if the value of X determines a unique value of Y
roll → name; roll → batch
For any two tuples t1 and t2 in any legal instance of r (R), if
t1 .X = t2 .X then t1 .Y = t2 .Y
A FD X → Y is trivial if it is satisfied for all instances of a relation
Y ⊆X
A candidate key functionally determines all attributes

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 6 / 31


Functional Dependencies
Functional dependencies (FDs) are constraints derived from the
meaning of and relationships among attributes
A set of attributes X functionally determines Y , denoted by
X → Y , if the value of X determines a unique value of Y
roll → name; roll → batch
For any two tuples t1 and t2 in any legal instance of r (R), if
t1 .X = t2 .X then t1 .Y = t2 .Y
A FD X → Y is trivial if it is satisfied for all instances of a relation
Y ⊆X
A candidate key functionally determines all attributes
Functional dependencies and keys define normal forms for
relations
Normal forms are formal measures of how “good” a database
design is

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 6 / 31


Armstrong’s Axioms
Given a set of FDs, additional FDs can be inferred using
Armstrong’s inference rules or Armstrong’s axioms
1 Reflexive: If Y ⊆ X , then X → Y
2 Augmentation: If X → Y , then X , Z → Y , Z
3 Transitive: If X → Y and Y → Z , then X → Z

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 7 / 31


Armstrong’s Axioms
Given a set of FDs, additional FDs can be inferred using
Armstrong’s inference rules or Armstrong’s axioms
1 Reflexive: If Y ⊆ X , then X → Y
2 Augmentation: If X → Y , then X , Z → Y , Z
3 Transitive: If X → Y and Y → Z , then X → Z
These rules are
Sound: Any other rule derived from these holds
Complete: Any rule which holds can be derived from these

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 7 / 31


Armstrong’s Axioms
Given a set of FDs, additional FDs can be inferred using
Armstrong’s inference rules or Armstrong’s axioms
1 Reflexive: If Y ⊆ X , then X → Y
2 Augmentation: If X → Y , then X , Z → Y , Z
3 Transitive: If X → Y and Y → Z , then X → Z
These rules are
Sound: Any other rule derived from these holds
Complete: Any rule which holds can be derived from these
Other inferred rules
4 Decomposition: If X → Y , Z , then X → Y and X → Z
5 Union: If X → Y and X → Z , then X → Y , Z
6 Pseudotransitivity: If X → Y and W , Y → Z , then W , X → Z

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 7 / 31


Properties of FDs
Closure of a set F of FDs is the set F + of all FDs that can be
inferred from F
Closure of a set of attributes X with respect to F is the set X + of
all attributes that are functionally determined by X using F +

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 8 / 31


Properties of FDs
Closure of a set F of FDs is the set F + of all FDs that can be
inferred from F
Closure of a set of attributes X with respect to F is the set X + of
all attributes that are functionally determined by X using F +
F covers G if every FD in G can be inferred from F
F covers G if G+ ⊆ F +

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 8 / 31


Properties of FDs
Closure of a set F of FDs is the set F + of all FDs that can be
inferred from F
Closure of a set of attributes X with respect to F is the set X + of
all attributes that are functionally determined by X using F +
F covers G if every FD in G can be inferred from F
F covers G if G+ ⊆ F +
Two sets of FDs F and G are equivalent if every FD in F can be
inferred from G and vice versa
F and G are equivalent if F + = G+
F and G are equivalent if F covers G and G covers F

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 8 / 31


Properties of FDs
Closure of a set F of FDs is the set F + of all FDs that can be
inferred from F
Closure of a set of attributes X with respect to F is the set X + of
all attributes that are functionally determined by X using F +
F covers G if every FD in G can be inferred from F
F covers G if G+ ⊆ F +
Two sets of FDs F and G are equivalent if every FD in F can be
inferred from G and vice versa
F and G are equivalent if F + = G+
F and G are equivalent if F covers G and G covers F
A set of FDs is minimal if
Every FD in F has only a single attribute in RHS
Any G ⊂ F is not equivalent to F
Any F − (X → A) ∪ (Y → A) where Y ⊂ X is not equivalent to F
Every set of FD has at least one equivalent minimal set
Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 8 / 31
Normal Forms
The process of decomposing relations into smaller relations that
conform to certain norms is called normalization
Keys and FDs of a relation determine which normal form a relation
is in
Different normal forms
1NF: based on attributes only
2NF, 3NF, BCNF: based on keys and FDs
4NF: based on keys and multi-valued dependencies (MVDs)
5NF or PJNF: based on keys and join dependencies
DKNF: based on all constraints

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 9 / 31


First Normal Form (1NF)
A relation is in 1NF if
Every attribute is atomic

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 10 / 31


First Normal Form (1NF)
A relation is in 1NF if
Every attribute is atomic
Phone numbers are not atomic

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 10 / 31


First Normal Form (1NF)
A relation is in 1NF if
Every attribute is atomic
Phone numbers are not atomic
Values like “CS315” may not be considered atomic

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 10 / 31


First Normal Form (1NF)
A relation is in 1NF if
Every attribute is atomic
Phone numbers are not atomic
Values like “CS315” may not be considered atomic

Id Name Phones
1 A {3, 4} should be
2 B {5}

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 10 / 31


First Normal Form (1NF)
A relation is in 1NF if
Every attribute is atomic
Phone numbers are not atomic
Values like “CS315” may not be considered atomic
Id Name Phone
Id Name Phones
1 A 3
1 A {3, 4} should be
1 A 4
2 B {5}
2 B 5

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 10 / 31


Nested Relations
Nested relations or composite attributes should be decomposed
Example
Faculty Name Course(CourseId, Title)
11 AB (1, yz)
12 CD (2, wx)
13 EF (2, wx)
13 EF (3, uv)
should be decomposed into

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 11 / 31


Nested Relations
Nested relations or composite attributes should be decomposed
Example
Faculty Name Course(CourseId, Title)
11 AB (1, yz)
12 CD (2, wx)
13 EF (2, wx)
13 EF (3, uv)
should be decomposed into
Faculty CourseId Title
Faculty Name
11 1 yz
11 AB
and 12 2 wx
12 CD
13 2 wx
13 EF
13 3 uv

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 11 / 31


Prime Attribute, Full and Transitive FD
A prime attribute must be a member of some candidate key
Example: roll
A non-prime attribute is not a member of any candidate key
Example: gender

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 12 / 31


Prime Attribute, Full and Transitive FD
A prime attribute must be a member of some candidate key
Example: roll
A non-prime attribute is not a member of any candidate key
Example: gender
A FD X → Y is a full functional dependency if the FD does not
hold when any attribute from X is removed
Example: (roll, courseid) → (grade)
It is a partial functional dependency otherwise
(roll, gender) → (name)

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 12 / 31


Prime Attribute, Full and Transitive FD
A prime attribute must be a member of some candidate key
Example: roll
A non-prime attribute is not a member of any candidate key
Example: gender
A FD X → Y is a full functional dependency if the FD does not
hold when any attribute from X is removed
Example: (roll, courseid) → (grade)
It is a partial functional dependency otherwise
(roll, gender) → (name)
A FD X → Y is a transitive functional dependency if it can be
derived from two FDs X → Z and Z → Y where Z is not a set of
prime attributes
Example: (roll) → (hod) since (roll) → (dept) and (dept) → (hod)
hold
It is non-transitive otherwise
Example: (roll) → (name)
Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 12 / 31
Second Normal Form (2NF)
A relation is in 2NF if
Every non-prime attribute is fully functionally dependent on every
candidate key

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 13 / 31


Second Normal Form (2NF)
A relation is in 2NF if
Every non-prime attribute is fully functionally dependent on every
candidate key
Alternatively, every attribute should either be
In a candidate key or
Depend fully on every candidate key

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 13 / 31


Second Normal Form (2NF)
A relation is in 2NF if
Every non-prime attribute is fully functionally dependent on every
candidate key
Alternatively, every attribute should either be
In a candidate key or
Depend fully on every candidate key
Consider (roll, courseid, grade, name, title) with FDs:
(roll, courseid) → (grade); (roll) → (name); (courseid) → (title)

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 13 / 31


Second Normal Form (2NF)
A relation is in 2NF if
Every non-prime attribute is fully functionally dependent on every
candidate key
Alternatively, every attribute should either be
In a candidate key or
Depend fully on every candidate key
Consider (roll, courseid, grade, name, title) with FDs:
(roll, courseid) → (grade); (roll) → (name); (courseid) → (title)
It is not in 2NF since (name) depends partially on (roll), and (title)
depends partially on (courseid)
After 2NF normalization,

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 13 / 31


Second Normal Form (2NF)
A relation is in 2NF if
Every non-prime attribute is fully functionally dependent on every
candidate key
Alternatively, every attribute should either be
In a candidate key or
Depend fully on every candidate key
Consider (roll, courseid, grade, name, title) with FDs:
(roll, courseid) → (grade); (roll) → (name); (courseid) → (title)
It is not in 2NF since (name) depends partially on (roll), and (title)
depends partially on (courseid)
After 2NF normalization,
(roll, courseid, grade) with FD: (roll, courseid) → (grade)
(roll, name) with FD: (roll) → (name)
(courseid, title) with FD: (courseid) → (title)

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 13 / 31


Third Normal Form (3NF)
A relation is in 3NF if
It is in 2NF, and
No non-prime attribute is transitively functionally dependent on the
candidate keys

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 14 / 31


Third Normal Form (3NF)
A relation is in 3NF if
It is in 2NF, and
No non-prime attribute is transitively functionally dependent on the
candidate keys
Alternatively, every non-prime attribute should be
Fully functionally dependent on every key, and
Non-transitively dependent on every key

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 14 / 31


Third Normal Form (3NF)
A relation is in 3NF if
It is in 2NF, and
No non-prime attribute is transitively functionally dependent on the
candidate keys
Alternatively, every non-prime attribute should be
Fully functionally dependent on every key, and
Non-transitively dependent on every key
Alternatively, for every FD X → Y , either
It is trivial, or
X is a superkey, or
Every attribute in Y − X is prime

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 14 / 31


Third Normal Form (3NF)
A relation is in 3NF if
It is in 2NF, and
No non-prime attribute is transitively functionally dependent on the
candidate keys
Alternatively, every non-prime attribute should be
Fully functionally dependent on every key, and
Non-transitively dependent on every key
Alternatively, for every FD X → Y , either
It is trivial, or
X is a superkey, or
Every attribute in Y − X is prime
Consider (facultyid, name, courseid, title) with FDs:
(facultyid) → (name, courseid); (courseid) → (title)

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 14 / 31


Third Normal Form (3NF)
A relation is in 3NF if
It is in 2NF, and
No non-prime attribute is transitively functionally dependent on the
candidate keys
Alternatively, every non-prime attribute should be
Fully functionally dependent on every key, and
Non-transitively dependent on every key
Alternatively, for every FD X → Y , either
It is trivial, or
X is a superkey, or
Every attribute in Y − X is prime
Consider (facultyid, name, courseid, title) with FDs:
(facultyid) → (name, courseid); (courseid) → (title)
It is not in 3NF since (title) depends transitively on (facultyid)
through (courseid)
After 3NF normalization,

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 14 / 31


Third Normal Form (3NF)
A relation is in 3NF if
It is in 2NF, and
No non-prime attribute is transitively functionally dependent on the
candidate keys
Alternatively, every non-prime attribute should be
Fully functionally dependent on every key, and
Non-transitively dependent on every key
Alternatively, for every FD X → Y , either
It is trivial, or
X is a superkey, or
Every attribute in Y − X is prime
Consider (facultyid, name, courseid, title) with FDs:
(facultyid) → (name, courseid); (courseid) → (title)
It is not in 3NF since (title) depends transitively on (facultyid)
through (courseid)
After 3NF normalization,
(facultyid, name, courseid) with FD: (facultyid) → (name, courseid)
(courseid, title) with FD: (courseid) → (title)
Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 14 / 31
Boyce-Codd Normal Form (BCNF)
A relation is in BCNF
If X → Y is a non-trivial FD, then X is a superkey of R

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 15 / 31


Boyce-Codd Normal Form (BCNF)
A relation is in BCNF
If X → Y is a non-trivial FD, then X is a superkey of R
Alternatively, for every FD X → Y , either
It is trivial, or
X is a superkey

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 15 / 31


Boyce-Codd Normal Form (BCNF)
A relation is in BCNF
If X → Y is a non-trivial FD, then X is a superkey of R
Alternatively, for every FD X → Y , either
It is trivial, or
X is a superkey
Also called 3.5NF

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 15 / 31


Boyce-Codd Normal Form (BCNF)
A relation is in BCNF
If X → Y is a non-trivial FD, then X is a superkey of R
Alternatively, for every FD X → Y , either
It is trivial, or
X is a superkey
Also called 3.5NF
BCNF decomposition can lose FDs

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 15 / 31


Boyce-Codd Normal Form (BCNF)
A relation is in BCNF
If X → Y is a non-trivial FD, then X is a superkey of R
Alternatively, for every FD X → Y , either
It is trivial, or
X is a superkey
Also called 3.5NF
BCNF decomposition can lose FDs
Consider (Id, Dist, Lot, Area) with FDs:
(Id) → (Dist, Lot, Area); (Dist, Lot) → (Id, Area); (Area) → (Dist)

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 15 / 31


Boyce-Codd Normal Form (BCNF)
A relation is in BCNF
If X → Y is a non-trivial FD, then X is a superkey of R
Alternatively, for every FD X → Y , either
It is trivial, or
X is a superkey
Also called 3.5NF
BCNF decomposition can lose FDs
Consider (Id, Dist, Lot, Area) with FDs:
(Id) → (Dist, Lot, Area); (Dist, Lot) → (Id, Area); (Area) → (Dist)
It is not in BCNF since (Area) is not a superkey although (Area) →
(Dist) holds
After BCNF normalization,

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 15 / 31


Boyce-Codd Normal Form (BCNF)
A relation is in BCNF
If X → Y is a non-trivial FD, then X is a superkey of R
Alternatively, for every FD X → Y , either
It is trivial, or
X is a superkey
Also called 3.5NF
BCNF decomposition can lose FDs
Consider (Id, Dist, Lot, Area) with FDs:
(Id) → (Dist, Lot, Area); (Dist, Lot) → (Id, Area); (Area) → (Dist)
It is not in BCNF since (Area) is not a superkey although (Area) →
(Dist) holds
After BCNF normalization,
(Id, Lot, Area) with FD: (Id) → (Dist, Lot, Area)
(Dist, Area) with FD: (Area) → (Dist)
Loses the FD (Dist, Lot) → (Id, Area)
Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 15 / 31
BCNF versus 3NF
Every BCNF relation is in 3NF
Good design ensures that every relation is at least in 3NF (if not
BCNF)

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 16 / 31


BCNF versus 3NF
Every BCNF relation is in 3NF
Good design ensures that every relation is at least in 3NF (if not
BCNF)
Difference lies in one condition
X → Y where Y is prime is allowed in 3NF

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 16 / 31


BCNF versus 3NF
Every BCNF relation is in 3NF
Good design ensures that every relation is at least in 3NF (if not
BCNF)
Difference lies in one condition
X → Y where Y is prime is allowed in 3NF
Consider (city, showroom, mall) with FDs:
(mall) → (city); (city, showroom) → (mall)

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 16 / 31


BCNF versus 3NF
Every BCNF relation is in 3NF
Good design ensures that every relation is at least in 3NF (if not
BCNF)
Difference lies in one condition
X → Y where Y is prime is allowed in 3NF
Consider (city, showroom, mall) with FDs:
(mall) → (city); (city, showroom) → (mall)
Candidate keys are (city, showroom) and (mall, showroom) but not
(city, mall)

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 16 / 31


BCNF versus 3NF
Every BCNF relation is in 3NF
Good design ensures that every relation is at least in 3NF (if not
BCNF)
Difference lies in one condition
X → Y where Y is prime is allowed in 3NF
Consider (city, showroom, mall) with FDs:
(mall) → (city); (city, showroom) → (mall)
Candidate keys are (city, showroom) and (mall, showroom) but not
(city, mall)
Not in BCNF as (mall) → (city) violates with (mall) not being a
superkey

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 16 / 31


BCNF versus 3NF
Every BCNF relation is in 3NF
Good design ensures that every relation is at least in 3NF (if not
BCNF)
Difference lies in one condition
X → Y where Y is prime is allowed in 3NF
Consider (city, showroom, mall) with FDs:
(mall) → (city); (city, showroom) → (mall)
Candidate keys are (city, showroom) and (mall, showroom) but not
(city, mall)
Not in BCNF as (mall) → (city) violates with (mall) not being a
superkey
BCNF decomposition is not possible while guaranting both
losslessness and dependency preservation

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 16 / 31


BCNF versus 3NF
Every BCNF relation is in 3NF
Good design ensures that every relation is at least in 3NF (if not
BCNF)
Difference lies in one condition
X → Y where Y is prime is allowed in 3NF
Consider (city, showroom, mall) with FDs:
(mall) → (city); (city, showroom) → (mall)
Candidate keys are (city, showroom) and (mall, showroom) but not
(city, mall)
Not in BCNF as (mall) → (city) violates with (mall) not being a
superkey
BCNF decomposition is not possible while guaranting both
losslessness and dependency preservation
Therefore, “good” design ensures either BCNF or its relaxation,
i.e., 3NF
Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 16 / 31
Lossy Decomposition
showroom city mall
tata kanpur iit
maruti kanpur zsq
tata kolkata quest

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 17 / 31


Lossy Decomposition
showroom city mall
tata kanpur iit
maruti kanpur zsq
tata kolkata quest
According to rule, (mall, city) and (showroom, city)

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 17 / 31


Lossy Decomposition
showroom city mall
tata kanpur iit
maruti kanpur zsq
tata kolkata quest
According to rule, (mall, city) and (showroom, city)
mall city showroom city
iit kanpur tata kanpur
zsq kanpur maruti kanpur
quest kolkata tata kolkata

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 17 / 31


Lossy Decomposition
showroom city mall
tata kanpur iit
maruti kanpur zsq
tata kolkata quest
According to rule, (mall, city) and (showroom, city)
mall city showroom city
iit kanpur tata kanpur
zsq kanpur maruti kanpur
quest kolkata tata kolkata
Joining produces
showroom city mall
tata kanpur iit
tata kanpur zsq
maruti kanpur iit
maruti kanpur zsq
tata kolkata quest
Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 17 / 31
Lossy Decomposition
showroom city mall
tata kanpur iit
maruti kanpur zsq
tata kolkata quest

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 18 / 31


Lossy Decomposition
showroom city mall
tata kanpur iit
maruti kanpur zsq
tata kolkata quest
If (mall, showroom) and (showroom, city)

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 18 / 31


Lossy Decomposition
showroom city mall
tata kanpur iit
maruti kanpur zsq
tata kolkata quest
If (mall, showroom) and (showroom, city)
mall showroom showroom city
iit tata tata kanpur
quest tata maruti kanpur
zsq maruti tata kolkata

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 18 / 31


Lossy Decomposition
showroom city mall
tata kanpur iit
maruti kanpur zsq
tata kolkata quest
If (mall, showroom) and (showroom, city)
mall showroom showroom city
iit tata tata kanpur
quest tata maruti kanpur
zsq maruti tata kolkata
Joining produces
showroom city mall
tata kanpur iit
tata kanpur quest
maruti kanpur zsq
tata kolkata iit
tata kolkata quest
Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 18 / 31
Lossless Decomposition
showroom city mall
tata kanpur iit
maruti kanpur zsq
tata kolkata quest

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 19 / 31


Lossless Decomposition
showroom city mall
tata kanpur iit
maruti kanpur zsq
tata kolkata quest

If (mall, showroom) and (mall, city)

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 19 / 31


Lossless Decomposition
showroom city mall
tata kanpur iit
maruti kanpur zsq
tata kolkata quest

If (mall, showroom) and (mall, city)


mall showroom mall city
iit tata iit kanpur
quest tata zsq kanpur
zsq maruti quest kolkata

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 19 / 31


Lossless Decomposition
showroom city mall
tata kanpur iit
maruti kanpur zsq
tata kolkata quest

If (mall, showroom) and (mall, city)


mall showroom mall city
iit tata iit kanpur
quest tata zsq kanpur
zsq maruti quest kolkata
Joining correctly produces
showroom city mall
tata kanpur iit
tata kolkata quest
maruti kanpur zsq

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 19 / 31


Loss of Functional Dependency
Possible decomposition is
(mall, city) and (mall, showroom)

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 20 / 31


Loss of Functional Dependency
Possible decomposition is
(mall, city) and (mall, showroom)
FD (city, showroom) → (mall) is lost

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 20 / 31


Loss of Functional Dependency
Possible decomposition is
(mall, city) and (mall, showroom)
FD (city, showroom) → (mall) is lost
This is allowed
mall city mall showroom
iit kanpur iit tata
zsq kanpur zsq tata

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 20 / 31


Loss of Functional Dependency
Possible decomposition is
(mall, city) and (mall, showroom)
FD (city, showroom) → (mall) is lost
This is allowed
mall city mall showroom
iit kanpur iit tata
zsq kanpur zsq tata
although joining them produces
mall city showroom
iit kanpur tata
zsq kanpur tata
that violates the FD (city, showroom) → (mall)

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 20 / 31


Example of Normalization
L = (Id, Dist, Lot, Area, Price, Rate) with FDs:
(Id) → (Dist, Lot, Area, Price, Rate)
(Dist, Lot) → (Id, Area, Price, Rate)
(Dist) → (Rate)
(Area) → (Price)

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 21 / 31


Example of Normalization
L = (Id, Dist, Lot, Area, Price, Rate) with FDs:
(Id) → (Dist, Lot, Area, Price, Rate)
(Dist, Lot) → (Id, Area, Price, Rate)
(Dist) → (Rate)
(Area) → (Price)
L is not in 2NF because (Rate) depends partially on (Dist)

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 21 / 31


Example of Normalization
L = (Id, Dist, Lot, Area, Price, Rate) with FDs:
(Id) → (Dist, Lot, Area, Price, Rate)
(Dist, Lot) → (Id, Area, Price, Rate)
(Dist) → (Rate)
(Area) → (Price)
L is not in 2NF because (Rate) depends partially on (Dist)
L1 = (Id, Dist, Lot, Area, Price) with FDs:
(Id) → (Dist, Lot, Area, Price)
(Dist, Lot) → (Id, Area, Price)
(Area) → (Price)
L2 = (Dist, Rate) with FD:
(Dist) → (Rate)

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 21 / 31


Example of Normalization
L = (Id, Dist, Lot, Area, Price, Rate) with FDs:
(Id) → (Dist, Lot, Area, Price, Rate)
(Dist, Lot) → (Id, Area, Price, Rate)
(Dist) → (Rate)
(Area) → (Price)
L is not in 2NF because (Rate) depends partially on (Dist)
L1 = (Id, Dist, Lot, Area, Price) with FDs:
(Id) → (Dist, Lot, Area, Price)
(Dist, Lot) → (Id, Area, Price)
(Area) → (Price)
L2 = (Dist, Rate) with FD:
(Dist) → (Rate)
L1 is in 2NF but not 3NF because (Price) depends on (Id) through
(Area)

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 21 / 31


Example of Normalization
L = (Id, Dist, Lot, Area, Price, Rate) with FDs:
(Id) → (Dist, Lot, Area, Price, Rate)
(Dist, Lot) → (Id, Area, Price, Rate)
(Dist) → (Rate)
(Area) → (Price)
L is not in 2NF because (Rate) depends partially on (Dist)
L1 = (Id, Dist, Lot, Area, Price) with FDs:
(Id) → (Dist, Lot, Area, Price)
(Dist, Lot) → (Id, Area, Price)
(Area) → (Price)
L2 = (Dist, Rate) with FD:
(Dist) → (Rate)
L1 is in 2NF but not 3NF because (Price) depends on (Id) through
(Area)
L2 is in 2NF and in 3NF

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 21 / 31


Example (contd.)
L1 = (Id, Dist, Lot, Area, Price) with FDs:
(Id) → (Dist, Lot, Area, Price)
(Dist, Lot) → (Id, Area, Price)
(Area) → (Price)
L1 is in 2NF but not 3NF because (Price) depends on (Id) through
(Area)

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 22 / 31


Example (contd.)
L1 = (Id, Dist, Lot, Area, Price) with FDs:
(Id) → (Dist, Lot, Area, Price)
(Dist, Lot) → (Id, Area, Price)
(Area) → (Price)
L1 is in 2NF but not 3NF because (Price) depends on (Id) through
(Area)
L11 = (Id, Dist, Lot, Area) with FDs:
(Id) → (Dist, Lot, Area)
(Dist, Lot) → (Id, Area)
L12 = (Area, Price) with FD:
(Area) → (Price)

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 22 / 31


Example (contd.)
L1 = (Id, Dist, Lot, Area, Price) with FDs:
(Id) → (Dist, Lot, Area, Price)
(Dist, Lot) → (Id, Area, Price)
(Area) → (Price)
L1 is in 2NF but not 3NF because (Price) depends on (Id) through
(Area)
L11 = (Id, Dist, Lot, Area) with FDs:
(Id) → (Dist, Lot, Area)
(Dist, Lot) → (Id, Area)
L12 = (Area, Price) with FD:
(Area) → (Price)
L11 and L12 are in 3NF

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 22 / 31


Normal Forms: Tests
1NF: The relation should have no multivalued attributes or nested
relations

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 23 / 31


Normal Forms: Tests
1NF: The relation should have no multivalued attributes or nested
relations
2NF: For a relation where candidate key contains multiple
attributes, no nonkey attribute should be functionally dependent
on a part of the candidate key

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 23 / 31


Normal Forms: Tests
1NF: The relation should have no multivalued attributes or nested
relations
2NF: For a relation where candidate key contains multiple
attributes, no nonkey attribute should be functionally dependent
on a part of the candidate key
3NF: The relation should not have a nonkey attribute functionally
determined by a set of nonkey attributes

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 23 / 31


Normal Forms: Tests
1NF: The relation should have no multivalued attributes or nested
relations
2NF: For a relation where candidate key contains multiple
attributes, no nonkey attribute should be functionally dependent
on a part of the candidate key
3NF: The relation should not have a nonkey attribute functionally
determined by a set of nonkey attributes
BCNF: The relation should not have an attribute functionally
determined by a set of nonkey attributes

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 23 / 31


Normal Forms: Remedies
1NF: Form new relations for each multi-valued attribute or nested
relation

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 24 / 31


Normal Forms: Remedies
1NF: Form new relations for each multi-valued attribute or nested
relation
2NF: Decompose and set up a relation for each partial key with its
dependent(s); retain the primary key and attributes fully
dependent on it

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 24 / 31


Normal Forms: Remedies
1NF: Form new relations for each multi-valued attribute or nested
relation
2NF: Decompose and set up a relation for each partial key with its
dependent(s); retain the primary key and attributes fully
dependent on it
3NF: Decompose and set up a relation for each transitively
dependent nonkey attribute with nonkey attributes that it
functionally depends upon

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 24 / 31


Normal Forms: Remedies
1NF: Form new relations for each multi-valued attribute or nested
relation
2NF: Decompose and set up a relation for each partial key with its
dependent(s); retain the primary key and attributes fully
dependent on it
3NF: Decompose and set up a relation for each transitively
dependent nonkey attribute with nonkey attributes that it
functionally depends upon
BCNF: Decompose and set up a relation for each nonkey attribute
with attributes functionally dependent on it

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 24 / 31


Anomalies with BCNF
Consider (course, teacher, book)
(c, t, b): t can teach c, and b is a textbook for c
No other FD
Therefore, relation is in BCNF

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 25 / 31


Anomalies with BCNF
Consider (course, teacher, book)
(c, t, b): t can teach c, and b is a textbook for c
No other FD
Therefore, relation is in BCNF
course teacher book
C1 AB B1
C1 AB B2
C1 CD B1
C1 CD B2
C2 EF B3
C2 EF B4
C2 AB B3
C2 AB B4

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 25 / 31


Anomalies with BCNF
Consider (course, teacher, book)
(c, t, b): t can teach c, and b is a textbook for c
No other FD
Therefore, relation is in BCNF
course teacher book
C1 AB B1
C1 AB B2
C1 CD B1
C1 CD B2
C2 EF B3
C2 EF B4
C2 AB B3
C2 AB B4
Modification anomalies are still there
Inserting a new teacher for C1 requires two tuples

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 25 / 31


Anomalies with BCNF
Consider (course, teacher, book)
(c, t, b): t can teach c, and b is a textbook for c
No other FD
Therefore, relation is in BCNF
course teacher book
C1 AB B1
C1 AB B2
C1 CD B1
C1 CD B2
C2 EF B3
C2 EF B4
C2 AB B3
C2 AB B4
Modification anomalies are still there
Inserting a new teacher for C1 requires two tuples
Better design if (course, teacher) and (course, book)
Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 25 / 31
Multi-Valued Dependency (MVD)
A multi-valued dependency (MVD) X ↠ Y holds for a relation
schema R if for all legal relations r (R), if for a pair of tuples t1 and
t2 , t1 .X = t2 .X , then there exists another pair of tuples t3 and t4
t1 .X = t2 .X = t3 .X = t4 .X
t3 .Y = t1 .Y
t3 .R − Y − X = t2 .R − Y − X
t4 .Y = t2 .Y
t4 .R − Y − X = t1 .R − Y − X
X Y R-Y-X
t1 a b c
t2 a d e
t3 a b e
t4 a d c
Example: (course) ↠ (teacher) in (course, teacher, book)
If (C1, AB, B1) and (C1, CD, B2) exist, then (C1, AB, B2) and (C1,
CD, B1) must exist
Otherwise, AB (resp. CD) has something special to do with B1
(resp. B2)
Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 26 / 31
MVD and Lossless Join
X ↠ Y implies X ↠ R − Y − X

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 27 / 31


MVD and Lossless Join
X ↠ Y implies X ↠ R − Y − X
R = (X, Y, Z)
X ↠ Y, and by symmetry, X ↠ Z
Then, decomposition into (X, Y) and (X, Z) will be lossless
For any relation r = ΠX ,Y (r ) Z ΠX ,Z (r )

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 27 / 31


MVD and Lossless Join
X ↠ Y implies X ↠ R − Y − X
R = (X, Y, Z)
X ↠ Y, and by symmetry, X ↠ Z
Then, decomposition into (X, Y) and (X, Z) will be lossless
For any relation r = ΠX ,Y (r ) Z ΠX ,Z (r )
A MVD X ↠ Y on R is trivial if either Y ⊆ X or R = X ∪ Y
It is non-trivial otherwise

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 27 / 31


MVD and Lossless Join
X ↠ Y implies X ↠ R − Y − X
R = (X, Y, Z)
X ↠ Y, and by symmetry, X ↠ Z
Then, decomposition into (X, Y) and (X, Z) will be lossless
For any relation r = ΠX ,Y (r ) Z ΠX ,Z (r )
A MVD X ↠ Y on R is trivial if either Y ⊆ X or R = X ∪ Y
It is non-trivial otherwise
Closure of a set of MVDs is the set of all MVDs that can be
inferred

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 27 / 31


Fourth Normal Form (4NF)
A relation is in 4NF
If X ↠ Y is a non-trivial MVD, then X is a superkey of R
Alternatively, for every MVD X ↠ Y , either
It is trivial, or
X is a superkey

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 28 / 31


Fourth Normal Form (4NF)
A relation is in 4NF
If X ↠ Y is a non-trivial MVD, then X is a superkey of R
Alternatively, for every MVD X ↠ Y , either
It is trivial, or
X is a superkey
Every 4NF relation is in BCNF
Consider (course, teacher, book) with MVD: course ↠ book

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 28 / 31


Fourth Normal Form (4NF)
A relation is in 4NF
If X ↠ Y is a non-trivial MVD, then X is a superkey of R
Alternatively, for every MVD X ↠ Y , either
It is trivial, or
X is a superkey
Every 4NF relation is in BCNF
Consider (course, teacher, book) with MVD: course ↠ book
It is not in 4NF since (course) is not a superkey
After 4NF normalization,

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 28 / 31


Fourth Normal Form (4NF)
A relation is in 4NF
If X ↠ Y is a non-trivial MVD, then X is a superkey of R
Alternatively, for every MVD X ↠ Y , either
It is trivial, or
X is a superkey
Every 4NF relation is in BCNF
Consider (course, teacher, book) with MVD: course ↠ book
It is not in 4NF since (course) is not a superkey
After 4NF normalization,
(course, book) with trivial MVD: (course) ↠ (book)
(course, teacher) with trivial MVD: (course) ↠ (teacher)
Decompose R with X ↠ Y into (X,Y) and (X,R-Y-X)

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 28 / 31


Fourth Normal Form (4NF)
A relation is in 4NF
If X ↠ Y is a non-trivial MVD, then X is a superkey of R
Alternatively, for every MVD X ↠ Y , either
It is trivial, or
X is a superkey
Every 4NF relation is in BCNF
Consider (course, teacher, book) with MVD: course ↠ book
It is not in 4NF since (course) is not a superkey
After 4NF normalization,
(course, book) with trivial MVD: (course) ↠ (book)
(course, teacher) with trivial MVD: (course) ↠ (teacher)
Decompose R with X ↠ Y into (X,Y) and (X,R-Y-X)
course teacher course book
C1 AB C1 B1
C1 CD C1 B2
C2 EF C2 B3
C2 AB C2 B4
Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 28 / 31
Join Dependency (JD)
General way of decomposing a relation into multi-way joins
A join dependency (JD) (R1 ⊆ R, . . . , Rn ⊆ R) holds for a schema
R if for all legal relations r (R),
Zni=1 (ΠRi (r )) = r

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 29 / 31


Join Dependency (JD)
General way of decomposing a relation into multi-way joins
A join dependency (JD) (R1 ⊆ R, . . . , Rn ⊆ R) holds for a schema
R if for all legal relations r (R),
Zni=1 (ΠRi (r )) = r
A JD is trivial if one of Ri is R itself

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 29 / 31


Join Dependency (JD)
General way of decomposing a relation into multi-way joins
A join dependency (JD) (R1 ⊆ R, . . . , Rn ⊆ R) holds for a schema
R if for all legal relations r (R),
Zni=1 (ΠRi (r )) = r
A JD is trivial if one of Ri is R itself
Salesman Brand Product
J A V
J A B
W A V
W A B
W R V
W R P
If S sells products of brand B and if S sells product type P, then S
must sell product type P of brand B (assuming B makes P)
This means that (S,B) Z (B,P) Z (P,S) is equal to (S,B,P)

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 29 / 31


Join Dependency (JD)
General way of decomposing a relation into multi-way joins
A join dependency (JD) (R1 ⊆ R, . . . , Rn ⊆ R) holds for a schema
R if for all legal relations r (R),
Zni=1 (ΠRi (r )) = r
A JD is trivial if one of Ri is R itself
Salesman Brand Product
J A V
J A B
W A V
W A B
W R V
W R P
If S sells products of brand B and if S sells product type P, then S
must sell product type P of brand B (assuming B makes P)
This means that (S,B) Z (B,P) Z (P,S) is equal to (S,B,P)
A MVD is a special case of JD with n = 2
Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 29 / 31
Fifth Normal Form (5NF) or Project-Join Normal Form
(PJNF)
A relation is in 5NF or PJNF
If (R1 , . . . , Rn ) is a non-trivial JD, then every Ri is a superkey of R

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 30 / 31


Fifth Normal Form (5NF) or Project-Join Normal Form
(PJNF)
A relation is in 5NF or PJNF
If (R1 , . . . , Rn ) is a non-trivial JD, then every Ri is a superkey of R
Consider that J starts selling brand R’s products
Insertion anomaly since multiple tuples need to be inserted

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 30 / 31


Fifth Normal Form (5NF) or Project-Join Normal Form
(PJNF)
A relation is in 5NF or PJNF
If (R1 , . . . , Rn ) is a non-trivial JD, then every Ri is a superkey of R
Consider that J starts selling brand R’s products
Insertion anomaly since multiple tuples need to be inserted
Better design if broken into three relations (B,P), (S,B), and (P,S)
Product Salesman
Brand Product
Salesman Brand V J
A V
J A B J
A B
W A V W
R V
W R B W
R P
P W
Now, insertion requires only one tuple (J, R) in (Salesman, Brand)

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 30 / 31


Domain-Key Normal Form (DKNF)
A relation schema is in domain-key normal form (DKNF) if all
constraints and relations that should hold can be enforced simply
by domain constraints and key constraints
Ideal normal form
Once a relation is in DKNF, there is no anomaly
Mostly theoretical

Arnab Bhattacharya ([email protected]) CS315: Normalization 2024-25 31 / 31

You might also like