Trivial and Non-Trivial Functional Dependency
Trivial Functional Dependency: A trivial functional dependency is one which will always hold in a relation. In the example given above, E-ID, E-NAME->E-ID is a trivial functional dependency and will always hold because {E-ID, E-NAME} ⊃ {E-ID}. You can also see from the table that for each value of {E-ID, E-NAME}, the value of E-ID is unique, so {E-ID, E-NAME} functionally determines E-ID.
Non-Trivial Functional Dependency: If a functional dependency is not trivial, it is called Non-Trivial Functional Dependency. Non-Trivial functional dependency may or may not hold in a relation. e.g.; E-ID->E-NAME is a non-trivial functional dependency that holds in the above relation.
Finding Attribute Closure and Candidate Keys using Functional Dependencies
In this article, we will find the attribute closure and also we will find the candidate keys using the functional dependency. We will look into this topic in detail. But before proceeding to this topic, we will first learn about what is functional dependency.
A functional dependency X->Y in a relation holds if two tuples having the same value for X also have the same value for Y i.e. X uniquely determines Y. Consider the table given below.
In the EMPLOYEE relation given in Table,
- Functional Dependency E-ID->E-NAME holds because, for each E-ID, there is a unique value of E-NAME.
- Functional Dependency E-ID->E-CITY and E-CITY->E-STATE also holds.
- Functional Dependency E-NAME->E-ID does not hold because E-NAME ‘John’ is not uniquely determining E-ID. There are 2 E-IDs corresponding to John (E001 and E003).
Table EMPLOYEE
E-ID |
E-NAME |
E-CITY |
E-STATE |
---|---|---|---|
E001 |
John |
Delhi |
Delhi |
E002 |
Mary |
Delhi |
Delhi |
E003 |
John |
Noida |
U.P. |
Table 1: The FD set for EMPLOYEE relation given in Table 1 are:
{E-ID->E-NAME, E-ID->E-CITY, E-ID->E-STATE, E-CITY->E-STATE}