Normalization is the process of splitting tables so that each fact is stored once. It rests on functional dependencies, which describe how one column determines another.
Functional dependency
X → Y means: if two rows have the same X value, they must have the same Y value. In student(roll_no, name, dept), roll_no → name holds because a roll number gives one name.
- Trivial: Y is part of X, for example
{roll_no, name} → name. - Non-trivial: Y is not part of X.
- Full dependency: Y depends on the whole key. Partial dependency: Y depends on only part of a composite key.
Armstrong's axioms
- Reflexivity: if Y ⊆ X then X → Y.
- Augmentation: if X → Y then XZ → YZ.
- Transitivity: if X → Y and Y → Z then X → Z.
Closure of a set of attributes X, written X⁺, is every attribute X determines. Example: for R(A, B, C, D) with A → B and B → C, we get A⁺ = {A, B, C}. A set whose closure contains all attributes is a key; if D is not determined by A, then A⁺ does not contain D, so A is not a key.
Why normalise: anomalies
Take enrol(roll_no, name, course_id, course_title). The student's name repeats for each course (update anomaly), a new course cannot be saved without a student (insertion anomaly), and deleting the last student of a course loses the course title (deletion anomaly).
Normal forms
| Form | Rule |
|---|---|
| 1NF | Every cell holds one atomic value; no repeating groups |
| 2NF | 1NF and no partial dependency on part of a composite key |
| 3NF | 2NF and no transitive dependency (non-key → non-key) |
| BCNF | For every non-trivial X → Y, X is a super key |
Worked example
order(order_id, product_id, product_name, qty) with key (order_id, product_id) and product_id → product_name.
- Partial dependency:
product_namedepends only onproduct_id. Not in 2NF. - Fix:
product(product_id, product_name)andorder_item(order_id, product_id, qty).
For 3NF, student(roll_no, dept_id, dept_name) has dept_id → dept_name, a transitive dependency. Split into student(roll_no, dept_id) and department(dept_id, dept_name).
Denormalization
Sometimes a designer joins tables back on purpose, or repeats a column, to make heavy read queries faster, as in reporting systems. This trades extra storage and update care for speed.
Common mistakes
- Treating 3NF and BCNF as the same. BCNF is stricter.
- Normalising without keeping the ability to rebuild the original data by a join (a lossless split).
Practice questions
- Define functional dependency with an example.
- State Armstrong's axioms.
- What is closure of an attribute set? Find A⁺ for A → B, B → C.
- Explain 1NF, 2NF and 3NF.
- What is denormalization and why is it used?
Answers to the practice questions
- X → Y means equal X values give equal Y values; for example
roll_no → name. - Reflexivity, augmentation and transitivity.
- All attributes determined by the set; A⁺ = {A, B, C}.
- 1NF atomic values; 2NF no partial dependency; 3NF no transitive dependency.
- Intentionally adding redundancy to speed up queries, at the cost of extra storage and update effort.
Sources
- Official BCA syllabus Database Management Systems, course code CC202, Unit II
- Raghu Ramakrishnan and Johannes Gehrke, Database Management Systems, 3rd edition, McGraw-Hill
