Functional dependency in databases refers to a type of dependency where the value of one attribute (the dependent attribute) is determined by the value of one or more other attributes (the determinant attributes). This dependency is considered to be functional because it satisfies the properties of a function, which means that for a given set of values for the determinant attributes, there will always be a unique value for the dependent attribute. This is represented using the symbol ‘→’ with the determinant attribute listed to the left of the arrow and the dependent attribute listed to the right, for example A → B, which reads as A determines B.
There are two types of functional dependencies:
Trivial dependency and non-trivial dependency.
Trivial dependency occurs when the dependent attribute is a subset of the determinant attribute, and is considered to be unimportant. In contrast,
Non-trivial dependency occurs when the dependent attribute is not a subset of the determinant attribute and is considered to be significant.
Functional dependency: A functional dependency in a database occurs when the value of one attribute is determined by the value of one or more other attributes. This dependency is considered functional because it satisfies the properties of a function, meaning that for a given set of values for the determinant attributes, there will always be a unique value for the dependent attribute.
Transitive dependency: When a functional dependency is achieved through two functional dependencies indirectly, it is called a transitive dependency. For example, if a table has a functional dependency A → B, and another functional dependency B → C, this suggests a transitive dependency A → C.
Consider the following table:
|123 main st
|456 park Ave
|123 Main St
|789 Elm St
In this table, we can see that the functional dependency of Major → Address exists. This is because for every student with a given major, the address is always the same. For example, for every student with a major of CS, the address is 123 Main St, and for every student with a major of Econ, the address is 789 Elm St.
Additionally, we can see that the functional dependency of ID → Name, ID → Major, ID → Address also exists, since ID acts as a unique identifier for each student.
It’s important to note that functional dependency can be derived from multiple attributes, in this case ID -> Name,Major, Address.