First Normal Form: 1NF
A table is in First Normal Form if: (1) each column contains atomic values, (2) there are no repeating groups, and (3) each row is unique.
Rule 1 — each column contains atomic values
The following table is not in 1NF:
| Student_ID | Student_Name | Courses |
|---|---|---|
| 101 | Rahim | Database, Programming |
| 102 | Karim | Networking |
…because the Courses column contains multiple values.
Fix — one value per cell, one course per row:
| Student_ID | Student_Name | Course |
|---|---|---|
| 101 | Rahim | Database |
| 101 | Rahim | Programming |
| 102 | Karim | Networking |
Rule 2 — there are no repeating groups
| Student_ID | Student_Name | Course_1 | Course_2 | Course_3 |
|---|---|---|---|---|
| 101 | Rahim | Database | Programming | Networking |
| 102 | Karim | Database | NULL | NULL |
Here Course_1, Course_2 and Course_3 are repeating groups, because they store the same type of data: course information. Note also the wasted NULLs — and the hard limit of three courses baked into the schema.
Fix:
| Student_ID | Student_Name | Course |
|---|---|---|
| 101 | Rahim | Database |
| 101 | Rahim | Programming |
| 101 | Rahim | Networking |
| 102 | Karim | Database |
Now there is only one Course column, and each course is stored in a separate row.
Rule 3 — each row is unique
Each row in a table should be uniquely identifiable. There should not be duplicate rows.
| Student_ID | Student_Name | Course |
|---|---|---|
| 101 | Rahim | Database |
| 101 | Rahim | Database |
| 102 | Karim | Programming |
The first two rows are exactly the same, so the rows are not unique.
| Student_ID | Student_Name | Course |
|---|---|---|
| 101 | Rahim | Database |
| 102 | Karim | Programming |
Checklist for the exam
Next: Second Normal Form →