BCNF Vs 3Nf: F R Superkey F R Superkey
BCNF Vs 3Nf: F R Superkey F R Superkey
BCNF Vs 3Nf: F R Superkey F R Superkey
BCNF: For every functional dependency X->Y in a set F of functional dependencies over relation R, either: Y is a subset of X or, X is a superkey of R 3NF: For every functional dependency X->Y in a set F of functional dependencies over relation R, either: Y is a subset of X or, X is a superkey of R, or Y is a subset of K for some key K of R
N.b., no subset of a key is a key
For every functional dependency X->Y in a set F of functional dependencies over relation R, either: Y is a subset of X or, X is a superkey of R, or Y is a subset of K for some key K of R
3NF Schema
Client, Office -> Client, Office, Account Account -> Office
Account A B A C Joe
Office
For every functional dependency X->Y in a set F of functional dependencies over relation R, either: Y is a subset of X or, X is a superkey of R, or Y is a subset of K for some key K of R
3NF Schema
Client, Office -> Client, Office, Account Account -> Office
Account A B A C Joe
Office
BCNF vs 3NF
For every functional dependency X->Y in a set F of functional dependencies over relation R, either: Y is a subset of X or, X is a superkey of R Y is a subset of K for some key K of R
Account A B A C Joe Mary John Joe Client 1 1 1 2 A B A C
3NF has some redundancy BCNF does not Unfortunately, BCNF is not dependency preserving, but 3NF is
Account A B C 1 1 2 Account -> Office Account Joe Mary John Joe Client Office
Office
Lossless decomposition
No non-trivial FDs
Closure
Want to find all attributes A such that X -> A is true, given a set of functional dependencies F
define closure of X as X*
Closure(X): c=X Repeat old = c if there is an FD Z->V such that Z c and V c then c=cUV until old = c return c
Closure(X): c=X Repeat old = c if there is an FD Z->V such that Z c and V c then c=cUV until old = c return c
BCNFify
For every functional dependency X->Y in a set F of functional dependencies over relation R, either: Y is a subset of X or, X is a superkey of R
BCNFify(schema R, functional dependency set F): D = {{R,F}} while there is a schema S with dependencies F' in D that is not in BCNF, do: given X->Y as a BCNF-violating FD in F such that XY is in S replace S in D with S1={XY,F1} and S2={(S-Y) U X, F2} where F1 and F2 are the FDs in F over S1 or S2 (may need to split some FDs using decomposition) End return D
B-tree Insertion
INSERTION OF KEY K
find the correct leaf node L; if ( L overflows ){ split L, by pushing the middle key upstairs to parent node P;
if (P overflows){
repeat the split recursively; } else{