Cheatsheet
Cheatsheet
by Lea Faris
Functional dependencies (FDs) Multi-valued dependencies (MVDs) Boyce-Codd Normal Form (BCNF)
A → B iff any 2 tuples that have the same value in A have the A multivalued dependency exists when there are at least three ”One thing one table:” for every A → B ∈ F + , either A → B is
same value in B, i.e. t1 [A] = t2 [B] =⇒ t1 [B] = t2 [B] attributes (like X,Y and Z) in a relation and for a value of X trivial or A is a superkey.
there is a well defined set of values of Y and a well defined set of
Armstrong’s rules values of Z. However, the set of values of Y is independent of set
Decomposition
1. Reflexivity – If α ⊆ R ∧ β ⊆ α, then α → β Z and vice versa.
2. Augmentation – If α → β ∧ γ ⊆ R, then γα → γβ Inference Rules Always lossless, not necessarily dependency preserving. Put
3. Transitivity – If α → β ∧ β → γ, then α → γ each A in its own table.
1. Complementation – If α ↠ β, then α ↠ (R − β) − α
4. Union – If α → β ∧ α → γ then α → βγ 2. Multivalued augmentation – If α ↠ β and 1. Identify the dependencies which violates the BCNF
5. Decomposition – If α → βγ, then α → β ∧ α → γ γ ⊆ R ∧ δ ⊆ γ, then γα ↠ δβ definition and consider that as X → A
6. Pseudotransitivity – If α → β ∧ γβ → δ then αγ → δ 3. Multivalued transitivity – If α ↠ β and
2. Decompose the relation R into XA and R − A.
β ↠ γ, then α ↠ γ − β
The first three are enough to be sound and complete. 4. Replication – If α → β, then α ↠ β 3. Validate if both the decomposition are in BCNF or not.
Soundness: they generate only true FDs i.e. F + ⊆ F ∗ If not re-apply algorithm on the decomposition that is
5. Coalescence – If α ↠ β and not in BCNF.
Completeness: they generate all FDs i.e. F ∗ ⊆ F + γ ⊆ β ∧ ∃δ : δ ⊆ R, ∧δ ∩ β = ∧δ → γ, then α → γ
Where F ∗ is everything logically implied by the definition of FD
and F . More helper rules 4th Normal Form
Armstrong relation 1. Multivalued union – If α ↠ β and α ↠ γ, then α ↠ βγ For every MVD α ↠ β, either it is trivial, or α is a superkey.
2. Intersection – If α ↠ β and α ↠ γ, then α ↠ β ∩ γ
Instance of R such that all FDs are satisfied and all not FDs are
not satisfied. 3. Difference – If α ↠ β and α ↠ γ then α ↠ β − γ and Decomposition
α↠γ−β
1. Compute closure of every set in the powerset of R. Same as BCNF decomposition! Except identify dependencies
2. Construct a table with each attribute as a header. Restriction of MVDs that violate 4NF. Compute the closure of D to make this easier.
3. For each set in the powerset, using the set as a subscript: Restriction of D to Ri is Di containing
• All FDs in D+ that include only attributes of Ri More Decomposition
(a) Add a row of 1s
• All MVDs of the form α ↠ (β ∩ Ri ) where α ⊆ Ri and Lossless join
(b) Add a row with 0s for attributes it does not α ↠ β is in D+ .
determine and 1s for attributes it does determine. A decomposition of R into R1 , R2 is lossless if there is a
Normal Forms primary key for R1 or R2 in R1 ∩ R2 . If decomposed into more
Closure than 2 relations, check all relations by joining the first two, then
F + denotes the closure of F .
1st Normal Form
the new one with the next one, etc.
For every FD A → B in F : No null values or sub-tables or multiple values per cell.