| Lesson 3 | Transitive Dependencies: |
| Objective | Define Transitive Dependencies |
A transitive dependency exists when a non-key attribute depends on another non-key attribute, creating an indirect path from the key to that attribute. In notation: if A → B and B → C, then A → C. In relational design, this pattern causes redundancy and anomalies even after a table satisfies Second Normal Form (2NF). Third Normal Form (3NF) removes these transitive dependencies.
Assume each CD belongs to exactly one category:
Item(ItemNo, Title, Price, CategoryID, CategoryName, CategoryManager)
We can express the functional dependencies as:
ItemNo → Title, Price, CategoryID
CategoryID → CategoryName, CategoryManager
Because ItemNo → CategoryID and CategoryID → (CategoryName, CategoryManager), we also have
ItemNo → (CategoryName, CategoryManager) via transitivity. Storing category name/manager in Item repeats that data for every item in the same category, inviting:
Item(ItemNo, Title, Price, CategoryID)
Category(CategoryID, CategoryName, CategoryManager)
Now non-prime attributes depend only on their keys, not through other non-prime attributes.
Suppose we start with a combined table:
Employees(Employee_ID, Department_ID, Department_Name, Department_Head)
Dependencies:
Employee_ID → Department_ID
Department_ID → Department_Name, Department_Head
Again, Employee_ID transitively determines Department_Name and Department_Head through Department_ID.
Employees(Employee_ID, Department_ID)
Departments(Department_ID, Department_Name, Department_Head)
Database Design for Mere Mortals
This removes transitive paths and centralizes department facts in one place.
Consider:
Passenger(PassengerId, Name, FareCode, FarePrice)
If a fare code has exactly one price:
FareCode → FarePrice
then PassengerId → FareCode and FareCode → FarePrice imply a transitive dependency from PassengerId to FarePrice.
Passenger(PassengerId, Name, FareCode)
Fare(FareCode, FarePrice)
2NF removes partial dependencies on a composite key. But even with a single-column key (or after 2NF), a table can still contain attributes that depend on other non-key attributes. That’s why achieving 3NF is the next step in a robust normalization process.
CategoryID, Department_ID, FareCode) to its own table where it is the key.Definition:
A transitive dependency exists when a non-prime attribute depends on another non-prime attribute.
Goal (3NF): Every non-prime attribute depends on the key, the whole key, and nothing but the key (i.e., no transitive path).
By isolating determinants and removing transitive paths, you reduce redundancy, prevent inconsistencies, and make queries and maintenance more predictable, whcih are all hallmarks of a well-normalized design.