Database Design: Functional Dependency
Hello there I thought might be a bit tricky functional dependencies might be tricky to understand for some people so I made this post on it. Hope it helps you understand them better.
What is a Functional Dependency?
A functional dependency is a relationship between two attributes, typically a primary key and a non-key attribute within a table(relation). In other words it is a set of constraints between two attributes in a relation. It is the starting point for data normalization. FDs exists when a relationship between two attributes allows you to uniquely determine the corresponding attribute’s value. If ‘X’ is known, and as a result of that value of X you are able to uniquely determine ‘Y’, there is functional dependency. Functional dependency is represented by an arrow sign (→) for instance, X→Y, which means X functionally determines Y or Y is dependent on X.
Rules of Functional Dependencies.
There is a group of rules that is used to infer functional dependencies in relational databases. In 1974, William W. Armstrong established a set of rules called Armstrong's Axioms to be used in the inference of all functional dependencies on relational databases. Let's look at these rules.
Axiom of Reflexivity
It states that If X is a set of attributes, and Y is a set of attributes that are completely contained in X that is Y is a subset of X, then X determines Y. If Y ⊆ X then , X → Y. For example, Address is composed of more than one piece of information; i.e. House_No, Street, and State. So according to the axiom of reflexivity Address (X) → House_No (Y) as House_No ⊆ Address.
Axiom of augmentation
This axiom is also known as partial dependency. It states that if X determines Y then XZ determines YZ for any Z. If X → Y, then XZ → YZ for any Z. This means adding attributes in dependencies, does not change the basic dependencies.
Axiom of transitivity
The axiom of transitivity also know as transitive dependency states that if X determines Y, and Y determines Z, then X must also determine Z i.e If X → Y and Y → Z, then X → Z.
Thank you for reading this post. Please comment, like and share if this helped your understand functional dependencies better.