Explain 1NF, 2NF and 3NF with examples.
MediumConceptNormalization
Answer
Each normal form adds one rule on top of the previous one.
- 1NF: every cell holds a single (atomic) value, with no lists or repeating groups.
- 2NF: the table is in 1NF, and no non-key column depends on only part of a composite primary key (no partial dependency).
- 3NF: the table is in 2NF, and no non-key column depends on another non-key column (no transitive dependency).
- A common summary: every non-key column depends on the key, the whole key and nothing but the key.
Example:
Not 1NF: roll | name | courses
1 | Asha | DBMS, OS
1NF: roll | name | course
1 | Asha | DBMS
1 | Asha | OS
The 1NF table has the key (roll, course), but name depends only on roll, a partial dependency. For 2NF, split it into student(roll, name) and enrolment(roll, course).
For 3NF: in student(roll, name, dept_id, dept_name), roll -> dept_id -> dept_name is transitive. Split it into student(roll, name, dept_id) and dept(dept_id, dept_name).