Relational Database Design and Modeling for Software Engineers
Ask Author
Back to course home

0% completed

Vote For New Content
Types of Functional Dependencies
Table of Contents

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible

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.

Image

1. Trivial Functional Dependency

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_IDCourse_IDName
101C101Alice Smith
102C102Bob Johnson
103C101Carol White
104C103David Brown

Here:

  • {Student_ID, Course_ID} → {Course_ID} is a trivial functional dependency because Course_ID is a subset of {Student_ID, Course_ID}.
  • {Student_ID} → {Student_ID} is also a trivial functional dependency since Student_ID is dependent on itself.

2. Non-Trivial Functional Dependency

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:

    • {Student_ID} → {Name} is a non-trivial functional dependency because Name is not a subset of Student_ID.
    • This implies that each Student_ID uniquely determines the Name of the student, ensuring that Student_ID is unique to each name.

3. Multivalued Functional Dependency

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_IDCourse_IDContact_Number
101C101123-456-7890
101C102123-456-7890
101C101098-765-4321
102C103234-567-8901

Here:

  • Student_ID →→ {Course_ID, Contact_Number} is a multivalued functional dependency because Course_ID and Contact_Number are independently associated with Student_ID. The contact number does not depend on the course, and vice versa.

4. Transitive Functional Dependency

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_IDDepartment_IDDepartment_Name
101D01Science
102D02Arts
103D01Science
104D03Commerce

In this case:

  • Student_ID → Department_ID and Department_ID → Department_Name.
  • By transitivity, Student_ID → Department_Name also holds, which is a transitive dependency. This dependency implies that Department_Name can be derived from Student_ID through Department_ID, resulting in redundant information. Transitive dependencies are often eliminated during normalization.

Summary Table of Functional Dependencies

Dependency TypeDefinitionExample
Trivial DependencyDependent attribute is a subset of the determinant attribute{Student_ID, Course_ID} → Course_ID
Non-Trivial DependencyDependent attribute is not a subset of the determinant attributeStudent_ID → Name
Multivalued DependencyOne attribute determines multiple independent values for anotherStudent_ID →→ {Course_ID, Contact_Number}
Transitive DependencyIndirect dependency where one attribute depends on another through a third attributeStudent_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.

.....

.....

.....

Like the course? Get enrolled and start learning!

Table of Contents

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible