Functional Dependency

What is functional dependency?

  • Functional Dependency is a relationship that exists between multiple attributes of a relation.
  • This concept is given by E. F. Codd.
  • Functional dependency represents a formalism on the infrastructure of relation.
  • It is a type of constraint existing between various attributes of a relation.
  • It is used to define various normal forms.
  • These dependencies are restrictions imposed on the data in database.
  • If P is a relation with A and B attributes, a functional dependency between these two attributes is represented as {A → B}. It specifies that,

  • AIt is a determinant set.
    BIt is a dependent attribute.
    {A → B}A functionally determines B.
    B is a functionally dependent on A.

  • Each value of A is associated precisely with one B value. A functional dependency is trivial if B is a subset of A.
  • 'A' Functionality determines 'B' {A → B} (Left hand side attributes determine the values of Right hand side attributes).

  • For example: <Employee> Table

    EmpIdEmpName
        

  • In the above <Employee> table, EmpName (employee name) is functionally dependent on EmpId (employee id) because the EmpId is unique for individual names.
  • The EmpId identifies the employee specifically, but EmpName cannot distinguish the EmpId because more than one employee could have the same name.
  • The functional dependency between attributes eliminates the repetition of information.
  • It is related to a candidate key, which uniquely identifies a tuple and determines the value of all other attributes in the relation.

Advantages of Functional Dependency

  • Functional Dependency avoids data redundancy where same data should not be repeated at multiple locations in same database.
  • It maintains the quality of data in database.
  • It allows clearly defined meanings and constraints of databases.
  • It helps in identifying bad designs.
  • It expresses the facts about the database design.