4. Design Principles Flashcards
Reasons for nomalization
Eliminates redundancy
Makes database more robust to changes
Makes database easier to understand
π {π΄, π΅, πΆ}
Normalization terminology
π {π΄, π΅, πΆ} - Denotes a relation R with attributes A, B, C
Functional dependency
Left-irreducability
Heathβs Theorem
π β π βΆ X Implies Y
Functional Dependencies
For two given subsets of the attributes of a relation x and y, π β π βΆ X Implies Y means that Y is functionally dependent on X
Means that: given a specific value of X, we can find its corresponding Y value
A dependency is trivial if Y is a subset of X
Closure
The closure of F is the set of all functional dependencies logically implied by F
Left Irreducibility
When π β π βΆ Y is irreducibly dependent upon X if X is as small a subset as possible
i.e. make your primary key a single column if possible
Heathβs Theorem
Let π
{π΄, π΅, πΆ} be a relational variable where π΄, π΅ and πΆ are
sets of attributes.
If I satisfies the functional dependency π΄ β π΅, R is equal to the join of its projections {A,B}, {A,C}
Meaning: we can split R into 2 relations β> one containing {A,B}, and one containing {A,C} β> then use join to recover the full table
Normalization
The decomposition of π
into π
1, π
2, π
n, β¦ , π
τ―‘ is non-loss if π
is equal to the join of π
1, β¦ , π
n
Normal Forms: Categories of normalization β> based on treatment of non-key attributes
Objective of normalization is to reduce risks of potential errors
β> so degrees of normal form are essentially degrees of risk you are open to
If a table meets a higher normal form, then it automatically meets the conditions of all of the lower ones
1st Normal Form
Relational variable is in 1st normal form iff every legal value of that relational variable contains exactly one value
No composite attributes
No multi-value attributes
Each row must be unique β> something must qualify as key
Each column must be unique β> no repeating groups of attributes
2nd Normal Form
Iff:
1) Requirements for 1st NF are met
2) Every non-key attribute is irreducibly dependent upon the primary key
Non-key attribute
Attribute that does not participate in the primary key
3rd Normal Form
Iff:
1) Requirements of 2NF are met
2) Every non-key attribute is non-transitively dependent upon the primary key
3) Every non-key attribute is Mutually Independent
4) There is irreducible dependency
Transitive dependency
π΄ β π΅ and π΅ β πΆ implies that π΄ β πΆ
Question to verify this:
If I change a non-key attribute, will I need to change any other non-key attribute?
RULE: non-key attributes should depend upon the key, the whole key, and nothing but the key
Mutually Independent
Two or more attributes are mutually independent if none of them is functionally dependent upon any combination of the others
Irreducibly Dependent
When π β π, π is irreducibly dependent upon π if π is as small a
subset as possible.