Understanding Functional Dependency in Databases

Dec 14, 2024

Lecture on Functional Dependency

Introduction

  • Functional dependency is crucial for understanding normalization in database management systems (DBMS).
  • It's essential to grasp the basics of functional dependency to understand normalization and normal forms.
  • The lecture provides an explanation of functional dependency with examples.

Definition

  • Functional Dependency (FD): A relationship where one attribute (or a set of attributes) determines another attribute.
  • Notation: Represented by an arrow, e.g., X β†’ Y, implying Y is functionally dependent on X.

Explanation

  • If you know the value of X, you can find the value of Y from the table, not by computation but by searching.
  • X is known as the determinant and Y as the dependent.
  • For a set of tuples, if X values are the same, Y values must be the same for FD to exist.

Examples and Rules

  • Example 1:

    • Relation R with attributes X and Y.
    • If X = 2 in the table, Y could be determined if it's uniquely associated with X.
    • If duplicate X values exist with different Y values, it's not a FD.
  • Mathematical Analogy: Like y = xΒ² + 5x, Y is dependent on X.

  • In DBMS, you search for Y using X values, not compute.

Key Rule

  • If in two tuples, T1.x = T2.x, then it must hold that T1.y = T2.y for FD to exist.

Practical Example

  • Relation: Students with attributes roll number, name, marks, department, and course.
  • Checking FD:
    • Roll number β†’ Name: No repetitions in roll number imply a FD.
    • Name β†’ Roll number: Possible only if names uniquely determine roll numbers.
    • Department β†’ Course: Not a FD if the same department has different courses.

Set of Attributes

  • X and Y can be sets of attributes, not just single ones.
  • Example: Roll number and name together determining marks.

Additional Considerations

  • Roll number can uniquely identify students, hence a FD exists.
  • Name may not uniquely identify students if duplicate names exist.

Complex Functional Dependencies

  • Multiple attributes can determine a set of other attributes.
  • Example: (Name, Marks) β†’ Department, Course.
  • Must check all combinations and ensure consistency.

Conclusion

  • Functional dependency is defined by uniformity in dependent values when determinant values match.
  • Practice problems can be used to test understanding of FDs in various relations.

Next Steps

  • Next lecture will cover types of functional dependencies and Armstrong's axioms, which are properties of FDs.