Bcse302l Dbms Module-3 Smsatapathy
Bcse302l Dbms Module-3 Smsatapathy
September 3, 2024
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 1
Outline
1 Schema Refinement
2 Functional Dependencies
3 Database Normalization
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 2
Schema Refinement
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 3
Informal Design Guidelines for Relation Schemas
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 4
Informal Design Guidelines for Relation Schemas
Guideline 1:
➔ Design a relation schema so that it is easy to explain its meaning.
➔ Do not combine attributes from multiple entity types and relationship
types into a single relation.
Violation of the design guideline - example
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 5
Informal Design Guidelines for Relation Schemas
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 6
Informal Design Guidelines for Relation Schemas
Anomalies that occur when joining relations
Insertion Anomalies
➔ Insert a new employee tuple into EMP DEPT → either include
attribute values for the department or else NULL (if he is not assigned
with any department)
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 7
Informal Design Guidelines for Relation Schemas
Deletion Anomalies
➔ we delete from EMP DEPT
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 8
Informal Design Guidelines for Relation Schemas
Modification Anomalies
➔ If one copy of such repeated data is updated then there is inconsistency
unless all repeated copies are similarly updated.
➔ In EMP DEPT, if we change the value of one of the attributes of a
particular department, say, the department 5 → we must update the
tuples of all employees who work in that department.
➔ otherwise, the database will become inconsistent If not, the same
department will be shown to have two different values for manager
which would be wrong.
Guideline 2:
➔ Design a schema that does not suffer from the insertion, deletion and
update anomalies.
➔ If there are any anomalies present, then note them so that applications
can be made to take them into account.
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 9
Informal Design Guidelines for Relation Schemas
3 Reducing Null Values in Tuples:
Problems:
➔ wastage of space at the storage level
➔ Difficult to understand the meaning of attributes and with specifying
JOIN operations
➔ Difficulty in applying aggregate function such as count, avg etc.
Guideline 3:
➔ Relations should be designed such that their tuples will have as few
NULL values as possible
➔ Attributes that are NULL frequently could be placed in separate
relations
Example: If 10% of employees have phone number then a separate
relation could be maintained to store the phone no of the employees
who have phone.
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 10
Informal Design Guidelines for Relation Schemas
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 11
Informal Design Guidelines for Relation Schemas
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 12
Informal Design Guidelines for Relation Schemas
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 13
Informal Design Guidelines for Relation Schemas
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 14
Functional Dependency (FD)
Formal tool for analysis of relational schemas.
It is used to specify the formal measures of the “goodness” of
relational design.
Definition: Functional dependency is a constraint between two sets of
attributes from the database.
A Functional Dependency (FD), denoted by x → y, between two sets
of attributes x & y, that are subsets of any universal relation schema
R specifies a constraint on the possible tuples of R.
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 15
Functional Dependency (FD)
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 16
Functional Dependency (FD)
A→B
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 17
Functional Dependency (FD)
A→B
➔ Tuple 1 and 2 violates constraint
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 17
Functional Dependency (FD)
A→B
➔ Tuple 1 and 2 violates constraint
D→C
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 17
Functional Dependency (FD)
A→B
➔ Tuple 1 and 2 violates constraint
D→C
➔ Tuple 3 and 4 violates constraint
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 17
Functional Dependency (FD)
A→B
➔ Tuple 1 and 2 violates constraint
D→C
➔ Tuple 3 and 4 violates constraint
C→D
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 17
Functional Dependency (FD)
A→B
➔ Tuple 1 and 2 violates constraint
D→C
➔ Tuple 3 and 4 violates constraint
C→D
➔ Tuple 2 and 3 violates constraint
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 17
Functional Dependency (FD)
B→C
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 18
Functional Dependency (FD)
B→C
➔ may hold
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 18
Functional Dependency (FD)
B→C
➔ may hold
C→B
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 18
Functional Dependency (FD)
B→C
➔ may hold
C→B
➔ may hold
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 18
Functional Dependency (FD)
B→C
➔ may hold
C→B
➔ may hold
(A,B)→D
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 18
Functional Dependency (FD)
B→C
➔ may hold
C→B
➔ may hold
(A,B)→D
➔ may hold
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 18
Diagrammatic Representation of Functional Dependency
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 19
Diagrammatic Representation of Functional Dependency
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 20
Diagrammatic Representation of Functional Dependency
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 21
Diagrammatic Representation of Functional Dependency
The following FDs hold in the above diagram
Ssn,Pnumber→Hours
Ssn→Ename
Pnumber→Pname,Plocation
F = Ssn→Ename,Bdate,Address,Dnumber
Dnumber→Dname,Dmgr ssn
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 22
Trivial and Non-trivial Dependency
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 23
Trivial and Non-trivial Dependency
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 24
Inference Rules for FDs
(or)
Armstrong’s Axioms
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 25
Armstrong’s Axioms
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 26
Armstrong’s Axioms
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 27
Armstrong’s Axioms
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 28
Armstrong’s Axioms
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 30
Armstrong’s Axioms
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 31
Armstrong’s Axioms
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 32
Multivalued dependency
Multivalued dependency occurs when there are more than one
independent multivalued attribute in a table.
In this case these two columns are said to be multivalued dependent
on bike model. These dependencies can be represented like this:
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 34
Practice Example
Solution:
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 34
Practice Example
Solution:
A → H [Transitive Rule ( A → B, B → H)]
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 34
Practice Example
Solution:
A → H [Transitive Rule ( A → B, B → H)]
CG → HI [Union Rule (CG → H, CG → I)]
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 34
Practice Example
Solution:
A → H [Transitive Rule ( A → B, B → H)]
CG → HI [Union Rule (CG → H, CG → I)]
AG → I [Pseudo-transitive Rule (A → C, CG → I)]
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 34
Inference Rules for FDs (Closure)
Closure of a set of FDs F is the set F + of all FDs that can be inferred
from F including 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.
X + can be calculated by repeatedly applying IR1 , IR2 , IR3 using the
FDs in F.
Attribute Closure:
Given a set of attributes x, the closure of x under F (denoted by x + )
is defined as the set of attributes that are functionally determined by
x under F.
Algorithm
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 35
Closure - Example 1
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 36
Closure - Example 1
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 36
Closure - Example 1
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 36
Closure - Example 1
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 36
Closure - Example 1
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 36
Closure - Example 1
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 37
Closure - Example 1
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 37
Closure - Example 1
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 37
Closure - Example 2
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 38
Closure - Example 2
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 38
Closure - Example 2
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 38
Closure - Example 2
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 38
Closure - Example 2
Consider a relation R ( A, B, C, D, E, F, G ) with the functional
dependencies - FD = {AB → CD, AF → D, DE → F, C → G, F → E, G
→ A}. Find CF + , BG + , AF + and AB +
Solution:
Closure of attribute CF
CF + = {C, F}
= {C, F, G} ( Using C → G )
= {C, E, F, G} ( Using F → E )
= {A, C, E, F, G} ( Using G → A )
= {A, C, D, E, F, G} ( Using AF → D )
Thus CF + = {A, C, D, E, F, G}
Closure of attribute BG
BG + = {B, G}
= {A, B, G} ( Using G → A )
= {A, B, C, D, G} ( Using AB → CD )
Thus BG + = {A, B, C, D, G}
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 38
Closure - Example 2
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 39
Closure - Example 2
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 39
Closure - Example 2
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 39
Closure - Example 3
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 40
Closure - Example 3
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 40
Closure - Example 3
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 40
Closure - Example 3
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 40
Closure - Example 3
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 40
Closure - Example 3
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 40
Closure - Example 3
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 40
Closure - Example 4
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 41
Closure - Example 4
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 41
Closure - Example 4
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 41
Closure - Example 4
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 41
Closure - Example 4
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 41
Closure - Example 5
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 42
Closure - Example 5
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 42
Closure - Example 5
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 42
Closure - Example 5
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 42
Closure - Example 5
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 42
Closure - Example 6
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 43
Closure - Example 6
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 43
Closure - Example 6
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 43
Closure - Example 6
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 43
Closure - Example 6
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 43
Closure - Example 6
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 43
Closure [Determining Candidate Key] - Example 7
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 44
Closure [Determining Candidate Key] - Example 7
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 44
Closure [Determining Candidate Key] - Example 7
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 44
Closure [Determining Candidate Key] - Example 8
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 45
Closure [Determining Candidate Key] - Example 8
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 45
Closure [Determining Candidate Key] - Example 8
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 45
Closure [Determining Candidate Key] - Example 9
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 46
Closure [Determining Candidate Key] - Example 9
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 46
Closure [Determining Candidate Key] - Example 9
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 46
Closure [Determining Candidate Key] - Example 10
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 47
Closure [Determining Candidate Key] - Example 10
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 47
Closure [Determining Candidate Key] - Example 10
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 47
Closure [Determining Candidate Key] - Example 10
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 47
Closure [Determining Candidate Key] - Example 10
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 47
Closure [Determining Candidate Key] - Example 10
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 47
Closure [Determining Candidate Key] - Example 10
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 47
Closure [Determining Candidate Key] - Example 10
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 47
Closure [Determining Candidate Key] - Example 10
Find all possible candidate keys of a relation scheme R(A, B, C, D, E, F,
G, H) with the following FDS = {CD → A, EC → H, GHB → AB, C →
D, H → B, BE → CD, EC → B}.
Solution:
Since EFG never appear on RHS of any FD. So, EFG must be part of
any key of R.
As A never appears on LHS of any FD, but appear on RHS. So A is
not part of any key of R.
{EFG }+ = {E, F, G} // not a ck
{BEFG }+ = {B, E, F, G, C, D, A, H} // it’s a ck
{CEFG }+ = {C, E, F, G, D, B, A, H} // it’s a ck
{DEFG }+ = {D, E, F, G} // not a ck
{HEFG }+ = {H, E, F, G, B, C, D, A} // it’s a ck
Hence, BEFG, CEFG, HEFG are the candidate keys of the relation R.
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 47
Closure [Determining Candidate Key] - Example 11
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 48
Closure [Determining Candidate Key] - Example 11
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 48
Closure [Determining Candidate Key] - Example 11
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 48
Closure [Determining Candidate Key] - Example 11
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 48
Closure [Determining Candidate Key] - Example 11
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 48
Closure [Determining Candidate Key] - Example 11
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 48
Closure [Determining Candidate Key] - Example 11
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 48
Closure [Determining Candidate Key] - Example 11
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 48
Closure [Determining Candidate Key] - Example 11
Find all possible candidate keys of a relation scheme R(A, B, C, D, E, F,
G, H) with the following FDS = {CH → G, A → BC, B → CFH, E → A,
F → EG}.
Solution:
As D can not be derived from any other attributes, so all possible
candidate keys must have attributes D.
As G never appears on LHS of any FD, but appears on RHS. So G is
not part of any key of R.
{D}+ = {D} // not a ck
{DA}+ = {A, D, B, C, F, H, E, G} // it’s a ck
{DB}+ = {B, D, C, F, H, E, G, A} // it’s a ck
{DC }+ = {D, C} // not a ck
{DE }+ = {D, E, A, B, C, F, H, G} // it’s a ck
{DF }+ = {D, F, E, G, A, B, C, H} // it’s a ck
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 48
Closure [Determining Candidate Key] - Example 11
Find all possible candidate keys of a relation scheme R(A, B, C, D, E, F,
G, H) with the following FDS = {CH → G, A → BC, B → CFH, E → A,
F → EG}.
Solution:
As D can not be derived from any other attributes, so all possible
candidate keys must have attributes D.
As G never appears on LHS of any FD, but appears on RHS. So G is
not part of any key of R.
{D}+ = {D} // not a ck
{DA}+ = {A, D, B, C, F, H, E, G} // it’s a ck
{DB}+ = {B, D, C, F, H, E, G, A} // it’s a ck
{DC }+ = {D, C} // not a ck
{DE }+ = {D, E, A, B, C, F, H, G} // it’s a ck
{DF }+ = {D, F, E, G, A, B, C, H} // it’s a ck
{DH}+ = {D, H} // not a ck
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 48
Closure [Determining Candidate Key] - Example 11
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 49
Closure [Determining Candidate Key] - Example 11
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 49
Closure [Determining Candidate Key] - Example 11
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 49
Closure [Determining Candidate Key] - Example 11
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 49
Closure [Determining Candidate Key] - Example 11
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 49
Prime and Non-Prime Attributes
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 50
Closure [Prime and Non-Prime Attributes] - Example 12
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 51
Closure [Prime and Non-Prime Attributes] - Example 12
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 51
Closure [Prime and Non-Prime Attributes] - Example 12
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 51
Closure [Prime and Non-Prime Attributes] - Example 12
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 51
Closure [Prime and Non-Prime Attributes] - Example 12
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 51
Closure [Prime and Non-Prime Attributes] - Example 12
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 51
Closure [Prime and Non-Prime Attributes] - Example 12
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 51
Closure [Prime and Non-Prime Attributes] - Example 12
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 51
Closure [Prime and Non-Prime Attributes] - Example 12
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 51
Closure [Prime and Non-Prime Attributes] - Example 12
Consider a relation scheme R(A, B, C, D, E) with the following FDS =
{AB → C, DE → B, CD → E}. Find all possible candidate keys and prime
and non-prime attributes.
Solution:
Since AD cannot be derived from any other attributes of R, so all the
possible candidate key must have attributes AD.
{AD}+ = {A, D} // not a ck
{ABD}+ = {A, B, D, C, E} // it’s a ck
{ADC }+ = {A, D, B, C, E} // it’s a ck
{ADE }+ = {A, D, E, B, C} // it’s a ck
Hence ABD, ADC, ADE are the three possible keys of the given
relation R as their closure contain all the attributes of R.
PRIME ATTRIBUTES = {A, B, D, C, E}
NON-PRIME ATTRIBUTES = {ϕ}
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 51
Closure - Practice Exercise - 1
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 52
Closure - Practice Exercise - 2
Consider the relation scheme R(A, B, C, D). Find all possible candidate
keys of the relation R.
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 53
Finding Equivalence Sets of FDs
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 54
Finding Equivalence Sets of FDs - Example 1
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 55
Finding Equivalence Sets of FDs - Example 2
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 56
Finding Equivalence Sets of FDs - Example 3
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 57
Canonical Cover / Minimal Cover
In any relational model, there exists a set of functional dependencies.
These functional dependencies when closely observed might contain
redundant attributes.
The ability of removing these redundant attributes without affecting
the capabilities of the functional dependency is known as “Canonical
Cover / Minimal Cover of Functional Dependency”.
Definition: A Canonical cover for a set of functional dependencies
(F) is another set of functional dependencies (FC ) such that all the
functional dependencies in F logically imply all the functional
dependencies in FC and vice versa.
Steps for finding minimal cover:
➔ Step 1: Singleton attribute on RHS [Decompose the functional
dependencies using Decomposition rule]
➔ Step 2: Remove extraneous attributes [Remove extraneous attributes
from LHS of functional dependencies by calculating the closure of FD’s
having two or more attributes on LHS]
➔ Step 3: Eliminate redundant FDs [Remove FD’s having transitivity]
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 58
Canonical Cover / Minimal Cover - Example
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 59
Canonical Cover / Minimal Cover - Example
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 59
Canonical Cover / Minimal Cover - Example
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 59
Canonical Cover / Minimal Cover - Example
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 59
Canonical Cover / Minimal Cover - Example
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 59
Canonical Cover / Minimal Cover - Example
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 59
Canonical Cover / Minimal Cover - Example
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 60
Canonical Cover / Minimal Cover - Example
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 60
Canonical Cover / Minimal Cover - Example
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 60
Canonical Cover / Minimal Cover - Example
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 60
Canonical Cover / Minimal Cover - Example
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 60
Canonical Cover / Minimal Cover - Example
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 61
Canonical Cover / Minimal Cover - Example
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 61
Canonical Cover / Minimal Cover - Example
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 61
Canonical Cover / Minimal Cover - Example
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 62
Canonical Cover / Minimal Cover - Example
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 62
Canonical Cover / Minimal Cover - Example
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 63
Canonical Cover / Minimal Cover - Example
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 63
Canonical Cover / Minimal Cover - Example
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 64
Canonical Cover / Minimal Cover - Practice Exercises
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 65
Canonical Cover / Minimal Cover
Example:
The following functional dependencies hold true for the relational scheme
R (W, X, Y, Z) –
X→W
WZ → XY
Y → WXZ
Write the irreducible equivalent for the given set of functional
dependencies.
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 66
Canonical Cover / Minimal Cover
Solution:
STEP 1: Write all the functional dependencies such that each
dependency contains only one attribute on its right side i.e- X → W,
WZ → X, WZ → Y, Y → W, Y → X, Y → Z
STEP 2: Check each functional dependency one by one whether it is
essential or not.
For X → W:
Including X → W, (X) + = X, W
Ignoring X → W, (X) + = X
Now, as the two results are different, it is concluded that X → W is
essential and cannot be eliminated.
For WZ → X:
Including WZ → X, (WZ) + = W, X, Y, Z
Ignoring WZ → X, (WZ) + = W, X, Y, Z
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 67
Canonical Cover / Minimal Cover
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 68
Database Normalization
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 69
Database Normalization
Here in this table, Department, Dept ID, and Manager Name are the
attributes that are same for all the employees. This type of repetition
of data is called redundancy.
Is There Any Solution?
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 70
Database Normalization
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 71
Database Normalization
Goal:
➔ Satisfy the attribute preservation property.
➔ Satisfy the lossless join or non-additive join property.
➔ Satisfy the dependency preservation property.
Types of Normalization:
➔ First Normal Form (1NF)
➔ Second Normal Form (2NF)
➔ Third Normal Form (3NF)
➔ Boyce-Codd Normal Form (BCNF)
➔ Fourth Normal Form (4NF)
➔ Fifth Normal Form (5NF)
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 72
First Normal Form (1NF)
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 73
First Normal Form (1NF)
Example - 1:
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 74
First Normal Form (1NF)
Example - 2:
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 75
First Normal Form (1NF)
Example - 3:
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 76
First Normal Form (1NF)
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 77
First Normal Form (1NF)
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 78
First Normal Form (1NF)
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 79
First Normal Form (1NF)
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 80
Second Normal Form (2NF)
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 81
Second Normal Form (2NF)
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 82
Second Normal Form (2NF)
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 83
Second Normal Form (2NF)
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 84
Second Normal Form (2NF)
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 85
Second Normal Form (2NF)
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 86
Third Normal Form (3NF)
(or)
A relation schema R is in 3NF if, whenever a nontrivial functional
dependency x → y holds in R, then either
➔ x is a superkey of R or
➔ y is a prime attribute of R.
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 87
Third Normal Form (3NF)
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 88
Third Normal Form (3NF)
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 89
Third Normal Form (3NF)
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 90
Third Normal Form (3NF)
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 91
Third Normal Form (3NF)
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 92
Third Normal Form (3NF)
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 93
Third Normal Form (3NF)
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 94
Third Normal Form (3NF)
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 95
Third Normal Form (3NF)
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 96
Third Normal Form (3NF) - Practice Exercise
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 97
Boyce-Codd Normal form (BCNF)
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 98
Boyce-Codd Normal form (BCNF)
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 99
Boyce-Codd Normal form (BCNF)
Suppose that there are two candidate keys: Property id# and
{County name, Lot#}; that is, lot numbers are unique only within
each county, but Property id# numbers are unique across counties for
the entire state.
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 99
Boyce-Codd Normal form (BCNF)
2NF
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 100
Boyce-Codd Normal form (BCNF)
2NF
3NF
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 100
Boyce-Codd Normal form (BCNF)
BCNF
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 101
Boyce-Codd Normal form (BCNF)
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 102
Boyce-Codd Normal form (BCNF)
The above picture shows the relation TEACH with the following
dependencies:
FD1: Student, Course → Instructor and FD2: Instructor → Course.
Student, Course is a candidate key for this relation.
This relation is in 3NF but not BCNF.
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 103
Boyce-Codd Normal form (BCNF)
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 104
Boyce-Codd Normal form (BCNF)
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 105
Properties of a Relational Decomposition
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 106
Properties of a Relational Decomposition
Attribute Preservation
Consider a Universal relation schema R = A1 , A2 , ..., An that includes
all the attributes of database.
Let F be the set of functional dependencies that hold on the
attributes of R.
Suppose that the universal schema R has decomposed into a set of
relations Ri in the decomposition set D so that no attributes are lost.
m R =R
Let D = R1, R2,. . . . . . , Rm Then Ui=1 i
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 107
Properties of a Relational Decomposition
Dependency Preservation
Each functional dependency x → y specified in F either appears
directly in one of the relations schemas Ri in the decomposition set D
or could be inferred from the dependencies that appear in Ri
(F1 ∪ F2 ∪ ..., ∪ Fn )+ ≡ F +
It is always possible to find a dependency preservation decomposition
D with respect to F such that each relation Ri in D is in 3NF.
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 108
Properties of a Relational Decomposition
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 109
Lossless or Non-additive Join Property - Example
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 110
Lossless or Non-additive Join Property - Example
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 110
Lossless or Non-additive Join Property - Example
Consider the following relational schema R(A, B, C, D, E, F, G, H, I, J)
with the following fds F = {AB → C, A → DE, B → F, F → GH, D →
IJ} and D = {R1 , R2 , R3 , R4 , R5 }, where R1 = (A,B,C), R2 = (A,D,E), R3
= (B,F), R4 = (F,G,H) and R5 = (D,I,J). Check whether the given
decomposition is lossless or not.
Solution:
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 110
Lossless or Non-additive Join Property - Example
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 111
Lossless or Non-additive Join Property - Example
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 111
Lossless or Non-additive Join Property - Example
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 111
Lossless or Non-additive Join Property - Example
For a decomposition to be lossless, it should hold the following conditions:
Union of attributes of R1 and R2 must be equal to attribute R. each
attribute of R must be either in R1 or in R2 i.e., Att(R1) ∪ Att(R2)
= Att(R)
Intersection of attributes of R1 and R2 must not be null i.e., Att(R1)
∩ Att(R2) ̸= ϕ
Common attribute must be a key for atleast one relation(R1 or R2)
i.e., Att(R1) ∩ Att(R2) → Att(R1) or Att(R1) ∩ Att(R2) → Att(R2)
A relation R(A,B,C,D) with FD set A → BC is decomposed into R1(ABC)
and R2(AD). This is lossless join decomposition because:
First rule holds true as Att(R1) ∪ Att(R2)=(ABC) ∪ (AD)= (ABCD)
= Att(R)
Second rule holds true as Att(R1) ∩ Att(R2) = (ABC) ∩ (AD) ̸= ϕ
Third rule holds true as Att(R1) ∩ Att(R2) = A is a key of R1(ABC)
because A → BC is given
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 112
Fourth Normal Form (4NF)
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 113
Fourth Normal Form (4NF)
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 114
Fourth Normal Form (4NF)
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 115
Fifth Normal Form (5NF)
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 116
Fifth Normal Form (5NF)
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 118
Fifth Normal Form (5NF)
When we combine the above three tables, the resultant table will be
the original SPC table.
But this might not be true in all cases i.e., when we combine the
separated tables, the resultant will not be equivalent to the original
table, in that case we should not break down the original table.
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 119
Practice Question (4NF & 5NF)
Consider a Student table which has information about the subjects and the
activity the students have enrolled in. Subject and Activity are the two
attributes that are independent of each other.
1 Check whether the given table is in 4NF? If not, partition the table
and convert to 4NF.
2 If the partition tables are in 4NF, check whether it is in 5NF?
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 120
Practice Question (4NF & 5NF)
Solution (i):
The table consists of multivalue dependency since all the column of
the table has duplicate values and the Subject ad Activity are
independent.
Hence, Student↠Subject and Student↠Activity exists in the table.
All the attributes of the table act as key.
So the Given table is not in 4NF.
So decompose the table R into R1(Student, Subject) and R2(Student,
Activity). In both the decomposed table, all attributes are key.
Now, the table R1 and R2 is in 4NF.
Solution (ii):
If above partition is considered then it is not in 5NF.
We decompose the table into R1, R2, and R3 such as R1(Student,
Subject), R2(Student, Activity) and R3(Subject, Activity).
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 121
Practice Question (4NF & 5NF)
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 122
Practice Question (4NF & 5NF)
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 123
Dr. Shashank Mouli Satapathy VIT - SCOPE - Database Systems BCSE302L - Module 3 September 3, 2024 124