BIT253 ยท 2082 ยท 5 marks
Define normalization. Explain first and second form of normalization. [1+4]
Define normalization. Explain first and second form of normalization. [1+4]
Quick answer
Normalization is the process of organizing the attributes and relations of a relational database to minimize data redundancy, eliminate undesirable insertion, deletion, and update anomalies, and ensure data integrity by decomposing larger tables into smaller, well-structured tables based on functional dependencies.
Normalization
Definition
First Normal Form (1NF)
A relation is said to be in First Normal Form (1NF) if:
- All attributes contain only atomic (indivisible) values (no multi-valued or composite attributes).
- Each column contains values of a single type.
- Each row is unique (there is a primary key).
- There are no repeating groups or arrays in any column.
Example
Not in 1NF (multi-valued attribute):
| StudentID | Name | Courses |
|---|---|---|
| 1 | Ram | Math, Science |
| 2 | Sita | English |
Converted to 1NF:
| StudentID | Name | Course |
|---|---|---|
| 1 | Ram | Math |
| 1 | Ram | Science |
| 2 | Sita | English |
Now each cell holds only one atomic value.
Second Normal Form (2NF)
A relation is said to be in Second Normal Form (2NF) if:
- It is already in 1NF, AND
- Every non-key attribute is fully functionally dependent on the entire primary key (i.e., there is no partial dependency).
Partial Dependency: A non-key attribute depends on only a part of a composite primary key, not the whole key.
2NF is relevant only when the primary key is composite (made up of two or more attributes).
Example
In 1NF but NOT in 2NF:
| StudentID | CourseID | StudentName | CourseName | Grade |
|---|---|---|---|---|
| 1 | C01 | Ram | Math | A |
| 1 | C02 | Ram | Science | B |
| 2 | C01 | Sita | Math | A |
- Primary Key: (StudentID, CourseID)
StudentNamedepends only onStudentID(partial dependency)CourseNamedepends only onCourseID(partial dependency)Gradedepends on bothStudentIDandCourseID(full dependency)
Converted to 2NF (remove partial dependencies):
Student Table:
| StudentID | StudentName |
|---|---|
| 1 | Ram |
| 2 | Sita |
Course Table:
| CourseID | CourseName |
|---|---|
| C01 | Math |
| C02 | Science |
Enrollment Table:
| StudentID | CourseID | Grade |
|---|---|---|
| 1 | C01 | A |
| 1 | C02 | B |
| 2 | C01 | A |
Now every non-key attribute is fully dependent on the entire primary key.
Summary
| Normal Form | Condition |
|---|---|
| 1NF | No multi-valued or composite attributes; all values atomic |
| 2NF | In 1NF + No partial dependency on composite primary key |
Short on time? The 1, 5 and 10 mark versions of this answer, flashcards and practice sets come with a program pass.