Download presentation
Presentation is loading. Please wait.
Published byAugust Gordon Modified over 9 years ago
1
Rensselaer Polytechnic Institute CSCI-4380 – Database Systems David Goldschmidt, Ph.D.
2
Given a set of attributes X, the closure X+ is the set of attributes functionally determined by X Given a relation R and a set F of functional dependencies, we need a way to find whether a functional dependency X Y is true with respect to F
3
Given relation R with attributes A, B, C, D, E and A BC, CD E, BE C AE _____? From reflexivity, AE+ = { A, E } From A BC, AE+ = { A, B, C, E } No other rules are applicable or add to AE+ We conclude that AE ABCE or simply AE BC Or AE A, AE B, AE C, and AE E
4
Given a set F of functional dependencies, the closure X+ of a set of attributes X is determined by the following algorithm: Initialize X+ to X Repeat until X+ does not change: ▪ Find any unapplied functional dependency Y Z in F such that Y X+ ▪ Set X+ = X+ Z
5
A key K for a given relation R is a minimal set of attributes A 1, A 2,..., A n such that closure {A 1, A 2,..., A n }+ is the set of all attributes of R MusicGroup(name, artist, genre, dateformed, datefirstjoined) name genre dateformed name artist datefirstjoined K must be (name, artist) because K+ = {name, artist, genre, dateformed, datefirstjoined}
6
Given a set F of functional dependencies, closure F+ is the set of all functional dependencies implied by F F+ can be found using the set of inference rules (reflexivity, transitivity, augmentation, etc.) Sets F 1 and F 2 of functional dependencies are considered equal if they have the same closure (i.e. F 1 + = F 2 +)
7
In addition to determining closure F+ for set F of functional dependencies, we can also derive any functional dependency that follows from F via Armstrong’s axioms: Reflexivity (if Y X, then X Y) Augmentation (if X Y, then XZ YZ) Transitivity (if X Y and Y Z, then X Z)
8
Given a set F of functional dependencies, any set of functional dependencies that’s equivalent to F is called a basis We limit the possibilities by requiring that each dependency has a single attribute on the right-hand side How many bases are there for a relation R with n functional dependencies in F?
9
A minimal basis for a relation R is a basis B that satisfies the following conditions: All functional dependencies in B have singleton right-hand sides If any functional dependency is removed from B, the result is no longer a basis If any left-hand side attribute is removed from a functional dependency of B, the result is no longer a basis
10
Given basis B, we can determine whether it is a minimal basis via the algorithm below: For each functional dependency X Y in B, check if B – { X Y } still implies X Y ▪ if so, remove X Y For each functional dependency XW Y in B, check if X+ is the same with respect to F and ( F – { XW Y } ) { X Y } ▪ if so, replace XW Y with X Y
11
Given relation R( A, B, C, D ) and functional dependencies AB C, C D, and D A What are the keys of R? What are the superkeys of R that are not keys? Is the given set of functional dependencies a basis? Is it a minimal basis?
12
What’s wrong with the relation below? MusicGroup( name, artist, genre, dateformed, datefirstjoined ) i.e. how can tuples become corrupted or incorrect?
13
Without normalization, problems with relations include: Unnecessary redundancy Insert anomalies Update anomalies Delete anomalies
14
Splitting a relation into two (more specific) relations is called decomposition The objective is to have each resulting relation be atomic i.e. each relation should contain only information related to the key
15
A given relation R with set F of functional dependencies is in BCNF if and only if all functional dependencies X Y in F are: either trivial (i.e. Y X) or X is a superkey of R If relation R is not in BCNF, it is possible to use decomposition to transform R to BCNF
16
Given a set F of functional dependencies for relation R( A 1, A 2,..., A n ) that is not in BCNF: Convert F to a minimal basis Find an X Y that violates BCNF Compute closure X+ Decompose R into: ▪ R 1 containing all attributes of X+ ▪ R 2 containing { A 1, A 2,..., A n } – ( X+ – X ) Project functional dependencies onto R 1 and R 2 Repeat!
17
Given relation R( A, B, C, D, E ) and functional dependencies AB AC, CE D, B A, and D AE What are the keys of R? What are the superkeys of R that are not keys? Is the given set of functional dependencies a basis? Is it a minimal basis? Is relation R in BCNF? If not, decompose R such that it is in BCNF
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.