Normal Forms and Functional Dependency 2 Flashcards
What is Normalization or Schema Refinement?
Normalization or Schema Refinement is a technique of organizing the data in the
database
* A systematic approach of decomposing tables to eliminate data redundancy and
undesirable characteristics
Normalization is used for mainly two purposes:
◦ Eliminating redundant (useless) data
◦ Ensuring data dependencies make sense, that is, data is logically stored
What is a Normal Form?
A normal form specifies a set of conditions that the relational schema must satisfy in terms of its constraints – they offer varied levels of guarantee for the design
What are some of the Normal Forms?
- Normalization rules are divided into various normal forms. Most common normal forms
are:
◦ First Normal Form (1NF)
◦ Second Normal Form (2NF)
◦ Third Normal Form (3NF)
Informally, a relational database relation is often described as ”normalized” if it meets
the third normal form. Most 3NF relations are free of insertion, update, and deletion
anomalies
Additional Normal Forms
◦ Elementary Key Normal Form (EKNF)
◦ Boyce-codd Normal Form (BCNF)
◦ Multivalued Dependencies And Fourth Normal Form (4NF)
◦ Essential Tuple Normal Form (ETNF)
◦ Join Dependencies and Fifth Normal Form (5NF)
◦ Sixth Normal Form (6NF)
◦ Domain/Key Normal Form (DKNF)
What is 1NF: First Normal Form?
A relation is in First Normal Form if and only if all underlying domains contain atomic
values only (doesn’t have multivalued attributes (MVA))
What is a Partial Dependency?
Partial Dependency:
Let R be a relational Schema and X, Y , A be the attribute sets over R where X : Any Candidate Key, Y : Proper Subset of Candidate Key, and A : Non Prime Attribute
If Y → A exists in R, then R is not in 2NF.
(Y → A) is a Partial dependency only if
* Y : Proper subset of Candidate Key
* A: Non Prime Attribute
A prime attribute of a relation is an attribute that is a part of a candidate key of the relation
What are Prime Attributes?
A prime attribute of a relation is an attribute that is a part of a candidate key of the relation
What is 2NF:Second Normal Form?
- Relation R is in Second Normal Form (2NF) only iff:
◦ R is in 1NF and
◦ R contains no Partial Dependency
What does 2NF ensure?
2NF ensures that no subset of a candidate key determines a non prime attribute. That is, there is no partial dependency in the relation.
What is a Transitive dependency?
A transitive dependency is a functional dependency which holds by virtue of transitivity. A transitive dependency can occur only in a relation that has three or more attributes.
* Let A, B, and C designate three distinct attributes (or distinct collections of attributes) in the relation. Suppose all three of the following conditions hold:
◦ A → B
◦ It is not the case that B → A
◦ B → C
* Then the functional dependency A → C (which follows from 1 and 3 by the axiom of
transitivity) is a transitive dependency
What is 3NF: Third Normal Form?
Let R be the relational schema.
* [E. F. Codd,1971] R is in 3NF only if:
◦ R should be in 2NF
◦ R should not contain transitive dependencies (OR, Every non-prime attribute of R is
non-transitively dependent on every key of R)
[Simple Statement] A relational schema R is in 3NF if for every FD X → A associated with R either
◦ A ⊆ X (that is, the FD is trivial) or
◦ X is a superkey of R or
◦ A is part of some candidate key (not just superkey!)
What does 3NF ensure?
3NF ensures that LHS is a superkey or RHS is a prime attribute. That is , no non prime attribute determines a non prime attribute.
Does 3NF ensure no redundancy?
No. There is some redundancy even in 3NF
How is 3NF important? What are its characteristics?
The next higher normal form is BCNF which is sometimes not dependency preserving. Hence, There is always a lossless-join, dependency-preserving decomposition into 3NF (tradeoff: some redundancy). Dependency preserving ensures that joins are not required for checking FDs.
1. Testing for 3NF has been shown to be NP-hard
2. Decomposition into 3NF can be done in polynomial time
How to decompose relations into 3NF?
Algorithm:
a) Eliminate redundant FDs, resulting in a canonical cover Fc of F
b) Create a relation Ri = XY for each FD X → Y in Fc
c) If the key K of R does not occur in any relation Ri, create one more relation Ri = K
What is BCNF?
A relation schema R is in BCNF with respect to a set F of FDs if for all FDs in F+ of the form α → β, where α ⊆ R and β ⊆ R at least one of the following holds:
◦ α → β is trivial (that is, β ⊆ α)
◦ α is a superkey for R