Functional Dependency


Functional Dependency (FD) is a concept in relational database design that describes the relationship between two attributes in a table. In simple terms, it specifies that the value of one attribute is determined by the value of another attribute.

Formally, a functional dependency is a constraint on a relation R that specifies that for any two tuples t1 and t2 in R, if t1 and t2 agree on a set of attributes X, then they must also agree on a set of attributes Y. This is denoted as X -> Y, where X and Y are sets of attributes in R.

For example, let’s consider a relation CUSTOMER that has the attributes {CUSTOMER_ID, NAME, AGE, ADDRESS}. If we observe that each customer ID is associated with a unique name, then we can say that CUSTOMER_ID -> NAME. This means that if we know the customer ID, we can determine the customer’s name.

FDs are important in database design because they help ensure that data is consistent and free from redundancy. By identifying the dependencies between attributes, we can normalize the database schema to eliminate redundant data and improve performance.

Also Read:  Evolution of Databases

There are several types of functional dependencies, including:

  • Trivial functional dependency: This is a dependency of an attribute on itself, or a dependency of an attribute on a subset of itself. For example, AGE -> AGE is a trivial dependency.
  • Non-trivial functional dependency: This is a dependency of an attribute on a proper subset of the other attributes. For example, CUSTOMER_ID -> NAME is a non-trivial dependency.
  • Full functional dependency: This is a dependency where the value of an attribute is determined by a combination of attributes, and cannot be determined by any proper subset of those attributes. For example, if we observe that each customer’s age is determined by their date of birth and the current date, we can say that AGE is fully dependent on the combination of BIRTH_DATE and CURRENT_DATE.

Functional dependencies are usually identified during the database design process, and are used to guide the normalization of the database schema. By eliminating redundant data and ensuring that data is consistent, functional dependencies help ensure that the database is efficient and reliable.

Leave a Reply