Normalization
Normalization
supplierName supplierAddr
Erik és Fia Bt. Budapest, Fő utca 1
Why is redundancy a problem?
• It causes anomalies
• Insertion anomaly
• can’t insert a piece of data without other pieces of data
• can’t insert supplier (name+address) without at least one product
• Deletion anomaly
• by deleting some data, other data is deleted too
• if you delete the last product of the supplier, its address disappears too
• Update anomaly
• changing the value of an attribute in one row means changing the
same attribute in other rows
• supplier changes address all its supplierAddr values shall be changed
• resolved by decomposition (not discussed)
Functional dependencies (FDs)
• Example:
• supplier name defines supplier address ==
• supplier address is functionally dependent on supplier name
==
• if supplier name is repeated in a relation, supplier address is
repeated too
• Definition:
• Given is relational schema R that includes attribute sets X and
Y.
Y is functionally dependent on X, i.e. XY
• if in the case of any relation r(R)
• if an arbitrary pair of elements t and t’ of r
• if the values of X in t equal the values of X in t’, i.e. t[X]==t’[X]
Functional dependencies (FDs)
• Remarks