Unit 5
Unit 5
ID Name Department Salary There are following possible functional dependencies for
1 A CSE 30000 the given relation:
• For given set of attributes, the closure of any attribute X under Functional
Dependency F, is the set of attributes that are functionally determined by X under
F.
• It is denoted by X+.
• For given set of attributes, the closure of any attribute X under Functional Dependency F, is the set of attributes that are
functionally determined by X under F.
• It is denoted by X+.
[X]+ = {Set of attributes determined by X}
Example:
Given relation R with attributes A,B,C,D,E,F,G and set of Functional Dependencies,
F = { A → B, B → C, AC → D, CD → E, G → A, AF → G }.
Find the Closure of A and AF.
Solution:
A+ ={ A, B, C, D, E)
[AF]+ = {A, B, C, D, E, F, G}
How to find super key using Closure of Attributes?
• X is a Super Key of R if X+ should determine all the attribute of Relation R.
Example:
R(ABCD), F = { A → B, B → C, C → D }
[A]+ = {A, B, C, D}
Hence, A is one of the super keys.
:Functional Dependency Preserving Decomposition:
• Let R be the Relational schema with functional dependency set F is decomposed into R1, R2,
R3…Rn sub relations with functional dependency set F1, F2, F3,...Fn respectively.
• Relational schema R with Functional Dependency Set F decomposed into R1 & R2 decomposition is lossless
if and only if all of the following conditions satisfy.
1. R1 ∩ R2 → R1 or R2
2. R1∪ R2 = R
3. R1 ∩ R2 = NULL
:Database Anomalies:
• Anomalies are problems that can occur in poorly planned,
un-normalized database where all the data are stored in one table.
• Anomalies lead to data redundancy and inconsistency. So it is
required to be eliminated.
Anomalies
• To solve the particular problem, divide composite attributes into number of sub- attribute and insert value in
proper sub attribute. This way, we can get the following table which is in 1 NF.
:Short Questions:
1. What is Functional Dependency? Explain with a suitable example.
2. What is Trivial Functional Dependency? Explain with a suitable example.
3. What is Non-Trivial Functional Dependency? Explain with a suitable example.
4. Define:
A. Super Key
B. Candidate Key
C. Primary Key
D. Closure of Attribute