Partial Dependency and Transitive Dependency in DBMS
Partial Dependency and Transitive Dependency in DBMS
Partial dependency violates the rules of Second Normal Form (2NF), as all non-key attributes
should be fully dependent on the entire primary key, not just part of it.
Consider the following table Student_Enrollments, where the composite primary key consists
of both Student_ID and Course_ID:
Here, the composite primary key is (Student_ID, Course_ID), which uniquely identifies each
row.
These partial dependencies violate the 2NF rule, which requires all non-key attributes to be
fully dependent on the whole primary key.
To bring the table into 2NF and remove partial dependencies, we split the original table into two
or more tables, ensuring that each non-key attribute depends entirely on its corresponding key.
Student_ID Student_Name
101 Alice
102 Bob
103 Charlie
Step 2: Create a Course table based on the partial dependency of Course_Name and
Instructor on Course_ID:
Step 3: Create an Enrollment table to store the relationships between Student_ID and
Course_ID, which will act as the bridge table between the two entities:
Student_ID Course_ID
101 C101
101 C102
102 C101
103 C103
1. Student Table:
Student_ID Student_Name
101 Alice
102 Bob
2. Course Table:
This table stores the Course_ID, Course_Name, and Instructor, ensuring that
Course_Name and Instructor are fully dependent on the primary key
Course_ID.
3. Enrollment Table:
This table holds the composite relationship between Student_ID and Course_ID,
ensuring that the relationship between students and courses is maintained without
any partial dependencies.
Student_ID Course_ID
101 C101
101 C102
102 C101
103 C103
Reduced Redundancy: Student names and course details no longer repeat in the original
table. Each piece of data is stored only once in its respective table.
Improved Data Integrity: By splitting the table, the chance of update anomalies is
reduced. If a student changes their name, for instance, it needs to be updated in only one
place (in the Student table).
Avoiding Anomalies: Insertion, update, and deletion anomalies are minimized. For
example, removing a student's enrollment won't delete the course information by
accident.
A → B → C:
In a properly normalized table (in 3NF), transitive dependencies are removed to prevent
redundancy and improve the efficiency of database updates.
Initial Table:
In this table:
The non-prime attributes Dept_Name and Dept_Location depend on Dept_ID, which is a non-
prime attribute, not directly on Employee_ID. This is a violation of the rules of 3NF.
To remove the transitive dependency, we need to split the table into two or more smaller tables.
This ensures that non-prime attributes depend only on the primary key.
1. Employee Table: Store information about employees, including the department they
belong to.
Explanation:
By separating the tables, we have removed the transitive dependency, bringing the database to
3NF. This design reduces redundancy, prevents anomalies, and ensures data integrity.