What is a Partial Dependency?
A partial dependency happens when a column (like student_name) depends on part of a composite key (like student_id), not the whole key (student_id, course).
Let’s See the Table Again
Imagine this table:
| student_id | course | student_name |
|---|---|---|
| 1 | Math | Alice |
| 1 | History | Alice |
| 2 | Math | Bob |
Suppose:
- Primary Key = (
student_id,course) → both columns together uniquely identify a row. - This means both
student_idandcourseare needed to tell one row apart from another.
What depends on what?
student_name— it depends only onstudent_id.- Wherever
student_id = 1, the name is always “Alice”, no matter what course. - It has nothing to do with which
coursethe student takes.
- Wherever
But:
- In a properly normalized table, all non-key columns should depend on the whole key — not just a part of it.
Why is this bad?
- Redundancy: “Alice” is repeated for every course Alice takes.
- Update problem: If Alice changes her name, you must update it in every row where
student_id = 1. - Data inconsistency: You could accidentally have “Alice” for Math and “Alise” for History — two different names for the same student!
Real-world Analogy
Think of it like this:
- Suppose you have a rental system where the key is (
PersonID,CarID) because one person can rent multiple cars. - But you store the person’s name with each rental.
- The name depends only on the person — not on which car they rent.
You shouldn’t repeat the name for each rental; you should store it once in a Person table!
Correct Fix — Split the Table
Students (student_id → student_name):
| student_id | student_name |
|---|---|
| 1 | Alice |
| 2 | Bob |
Enrollments (student_id + course):
| student_id | course |
|---|---|
| 1 | Math |
| 1 | History |
| 2 | Math |
Now:
student_namedepends only onstudent_id(good — and we don’t repeat it).coursedepends on bothstudent_idandcourse(good — this pair is unique).
Key Point
In 2NF, every non-key column must depend on the whole composite key — not just part of it.
If you can say:
“This column only needs
student_idto be known, not the full (student_id,course)” — then you have a partial dependency, and you are NOT in 2NF.