0% completed
In relational databases, different types of functional dependencies help in understanding relationships between attributes. These dependencies guide database normalization, ensuring data consistency, reducing redundancy, and maintaining data integrity.
Let’s go over four main types of functional dependencies using examples based on a Student and Course table.
A trivial functional dependency occurs when an attribute (or set of attributes) in the dependent set is a subset of the determinant set. In simple terms, if an attribute on the right side of a dependency is part of the left side, it is considered trivial.
Notation: X → Y is trivial if Y is a subset of X.
Example: Consider the Student table with attributes {Student_ID, Course_ID, Name}.
Student_ID | Course_ID | Name |
---|---|---|
101 | C101 | Alice Smith |
102 | C102 | Bob Johnson |
103 | C101 | Carol White |
104 | C103 | David Brown |
Here:
A non-trivial functional dependency occurs when the dependent attribute is not a subset of the determinant attribute. This type of dependency provides meaningful information about the relationships between attributes in a table.
Notation: X → Y is non-trivial if Y is not a subset of X.
Example: In the Student table above:
A multivalued functional dependency exists when one attribute determines a set of values for another attribute independently of other attributes. In this case, the dependent attributes are not dependent on each other.
Notation: X →→ {Y, Z} implies a multivalued dependency if Y and Z are independent.
Example: Consider a modified Student_Course table where each student can have multiple courses and multiple contact numbers.
Student_ID | Course_ID | Contact_Number |
---|---|---|
101 | C101 | 123-456-7890 |
101 | C102 | 123-456-7890 |
101 | C101 | 098-765-4321 |
102 | C103 | 234-567-8901 |
Here:
A transitive functional dependency occurs when there is an indirect relationship between attributes. If we have two dependencies, X → Y and Y → Z, then by transitivity, X → Z also holds. This type of dependency should be eliminated in normalization to achieve the third normal form (3NF).
Notation: If X → Y and Y → Z, then X → Z is a transitive dependency.
Example: Consider the following Student_Department table.
Student_ID | Department_ID | Department_Name |
---|---|---|
101 | D01 | Science |
102 | D02 | Arts |
103 | D01 | Science |
104 | D03 | Commerce |
In this case:
Dependency Type | Definition | Example |
---|---|---|
Trivial Dependency | Dependent attribute is a subset of the determinant attribute | {Student_ID, Course_ID} → Course_ID |
Non-Trivial Dependency | Dependent attribute is not a subset of the determinant attribute | Student_ID → Name |
Multivalued Dependency | One attribute determines multiple independent values for another | Student_ID →→ {Course_ID, Contact_Number} |
Transitive Dependency | Indirect dependency where one attribute depends on another through a third attribute | Student_ID → Department_ID, Department_ID → Department_Name |
Understanding these dependencies is essential for effective database normalization and ensures that data remains consistent, non-redundant, and easy to maintain.
.....
.....
.....