DBMS Notes
Each higher normal form is a stricter superset of the one below it.
The Normal Forms Ladder
| Normal Form | Condition Eliminated |
|---|---|
| 1NF | Non-atomic (multi-valued, composite) attributes |
| 2NF | Partial functional dependencies |
| 3NF | Transitive functional dependencies |
| BCNF | Every determinant is a candidate key |
| 4NF | Non-trivial multivalued dependencies |
| 5NF | Join dependencies |
2NF — Second Normal Form
Definition
A relation is in 2NF if:
- It is in 1NF, AND
- Every non-key attribute is fully functionally dependent on the entire primary key (no partial dependencies)
Partial dependency only occurs when the primary key is composite. If PK is a single attribute, 2NF is automatically satisfied if 1NF holds.
Identifying Partial Dependencies
| Primary Key | (SID, CID) |
| (SID, CID) | Grade ← Full dependency ✓ |
| SID | SName ← PARTIAL (depends on part of PK) ✗ |
| CID | CName ← PARTIAL (depends on part of PK) ✗ |
Converting to 2NF
Remove partial dependencies into separate tables:
Visual Diagram
3NF — Third Normal Form
Definition
A relation is in 3NF if:
- It is in 2NF, AND
- No non-key attribute is transitively dependent on the primary key
A transitive dependency: X → Y → Z (where X is the PK, Y is a non-key attribute, Z depends on Y).
Identifying Transitive Dependencies
| Primary Key | EmpID |
| EmpID | DeptID ← direct (OK) |
| DeptID | DeptName ← DeptName depends on non-key DeptID |
| DeptID | DeptLocation |
| EmpID | DeptName ← TRANSITIVE (via DeptID) ✗ |
| EmpID | DeptLocation← TRANSITIVE (via DeptID) ✗ |
Converting to 3NF
3NF Test (Formal Definition)
A relation R with FD set F is in 3NF if, for every non-trivial FD X → A in F⁺:
- X is a superkey of R, OR
- A is a prime attribute (part of some candidate key)
BCNF — Boyce-Codd Normal Form
Definition
A relation is in BCNF if, for every non-trivial functional dependency X → Y, X is a superkey (candidate key or superset).
BCNF is stricter than 3NF — the 3NF exception for prime attributes is removed.
3NF vs BCNF
Example — 3NF but NOT BCNF
| (Student, Course) | Instructor (a student-course pair has one instructor) |
| Instructor | Course (each instructor teaches one course) |
| Candidate Keys | (Student, Course) and (Student, Instructor) |
| Is it in 3NF? YES (the FD Instructor | Course has Course as prime attribute) |
| Is it in BCNF? NO! Because Instructor | Course, |
Converting to BCNF
Before
CourseInstructor(Student, Course, Instructor)
The FD causing violation: Instructor → Course
Decompose by pulling out the violating FD
Instructor_Course(Instructor, Course) ← contains Instructor → Course
Student_Instructor(Student, Instructor) ← remaining attributes
Both are in BCNF ✓
BCNF Decomposition Algorithm
WHILE relation R is not in BCNF
Find FD X → Y in R that violates BCNF
(X is not a superkey)
Decompose R into
R1 = X ∪ Y (XY)
R2 = X ∪ (R − Y) (R minus Y, keep X)
Replace R with R1 and R2
Comparison Table
| 1NF | 2NF | 3NF | BCNF | |
|---|---|---|---|---|
| -- | ----- | ----- | ----- | ------ |
| Atomic values | ✓ | ✓ | ✓ | ✓ |
| No partial deps | ✓ | ✓ | ✓ | |
| No transitive deps | ✓ | ✓ | ||
| Every determinant is candidate key | ✓ | |||
| Dependency preservation guaranteed | ✓ | ✓ | ✓ | Not always |
Continue the lesson path