Functional Dependency
Functional Dependency
Lecture 6
Functional Dependency
Relational Model
The relational model uses a collection of tables to represent both data and
relationships among those data
painter
painter
An update anomaly occurs when the same piece of data is stored in multiple places,
and all instances of the data must be updated to maintain consistency. If one instance is
updated and others are not, it leads to inconsistent data
Feature of Good Relational Design
A deletion anomaly occurs when the deletion of data representing one fact inadvertently
results in the loss of additional, potentially important data.
Example: Mozart leave the university, lets delete Mozart → lead → loss information about
Music Department
Feature of Good Relational Design
A deletion anomaly occurs when the deletion of data representing one fact inadvertently
results in the loss of additional, potentially important data.
Example: Mozart leave the university, lets delete Mozart → lead → loss information about
Music Department
Feature of Good Relational Design
An insertion anomaly occurs when certain data cannot be inserted into the
database without the presence of other, potentially unrelated data.
ID, name, salary absent and where ID may primary Key (therefore we can’t insert
that department using SQL)
Feature of Good Relational Design
Minimal Redundancy Combine Schema?
instructor Department
This suggests that using inst dept is a bad idea since it stores the budget amounts
redundantly and runs the risk that some user might update the budget amount in one tuple
but not all, and thus create inconsistency.
Why do we think of joining two table → Simple SQL query (without JOIN)
Feature of Good Relational Design
Decomposition
To avoid redundancy and inconsistency of data/record , need to decompose the LARGE
table.
employee1(ID,name)
employee2(name,street,city,salary)
lossy decompositions
lossless decompositions
→ Design a good relational database
A→B
Functional Dependency
A→B
A→B
Does not hold
A→C
Functional Dependency
A→B
Does not hold
A→C
It is hold
Functional Dependency
A→B
Does not hold
A→C
It is hold
C→A
Functional Dependency
A→B
Does not hold
A→C
It is hold
C→A
Does not hold
A→D
Functional Dependency
A→B
Does not hold
A→C
It is hold
C→A
Does not hold
A→D
Does not hold
D→B
It is hold
Functional Dependency
Is it correct? / Does it hold?
AB → C
CD → B
A → CD
Functional Dependency
Functional Dependency
E
E1
E2
E3
E4
E5
Functional Dependency
Key
E
E→A
E1
E2 E→B
E3
E4 E → AB
E5
Functional Dependency
Key
E
Superkey
E1
E2
E3
E4
E5
F E
Candidate Key
F1 E1
F1 E2
F2 E3
F3 E4
F4 E1
If X → Y
Then adding any set of attribute Z to both X and Y does not change the
functional dependency
FDs Properties
Armstrong’s Axioms
Transitivity
If X→ Y and Y → Z, then X → Z.
FDs Properties
Additional Rule
Union Rule:
FDs Properties
Additional Rule
Union Rule:
FDs Properties
Additional Rule
Decomposition Rule:
FDs Properties
Additional Rule
Decomposition Rule:
FDs Properties
Additional Rule
Pseudo-transitivity Rule:
Functional Dependency
Functional Dependency
FDs Rules
FDs Rules
X and Y → either single attribute or set of attribute
FDs Rules
FDs Rules
Closure of a Set of Functional Dependency
Closure of a Set of Functional Dependency
Closure of a Set of Functional Dependency
Closure of a Set of Functional Dependency
Find Key Using Functional Dependency
Find Key Using Functional Dependency
Find Key Using Functional Dependency
Find Key Using Functional Dependency
Find Key Using Functional Dependency
Find Key Using Functional Dependency
Find Key Using Functional Dependency
Find Key Using Functional Dependency
Find Key Using Functional Dependency
Find Key Using Functional Dependency
Find Key Using Functional Dependency
Find Key Using Functional Dependency
Find Key Using Functional Dependency
Find Key Using Functional Dependency
Find Key Using Functional Dependency
Find Key Using Functional Dependency
Find Key Using Functional Dependency
Find Key Using Functional Dependency
Find Key Using Functional Dependency
Find Key Using Functional Dependency
Find Key Using Functional Dependency
Find Key Using Functional Dependency
Find Key Using Functional Dependency
Find Key Using Functional Dependency
Find Key Using Functional Dependency
Find Key Using Functional Dependency
Find Key Using Functional Dependency
Find Key Using Functional Dependency
Find Key Using Functional Dependency
Find Key Using Functional Dependency
Find Key Using Functional Dependency
Find Key Using Functional Dependency
Find Key Using Functional Dependency
Find Key Using Functional Dependency
Find Key Using Functional Dependency
Find Key Using Functional Dependency
Find Key Using Functional Dependency