In a database management system, functional dependence (FD) is a constraint that establishes the relationship between one attribute and another attribute. Functional Dependency aids in preserving the integrity of the database's data.
If there is only one non-key attribute in the table, any changes made to the primary key attribute also affect the non-key attribute. If any changes are made to the functional dependencies, the primary key table contents will be affected, and the functional dependencies are said to have a "minimal" functional dependency case,
Finding the distinction between excellent and terrible database architecture is crucial. Suppose you want to improve your skills and practice more in DBMS. I recommend that you check out the KnowledgeHut MongoDB course.
What is Functional Dependency in DBMS
Rows and columns are used to store data in relational databases. While each row in a table represents a group of linked data, and every row in the table has the same structure, columns indicate the characteristics of the data. A tuple is another name for the row.
In a database management system (DBMS) system, functional Dependency in DBMS establishes the relationship between one attribute and another attribute. Functional dependencies make the quality of the data in the database easier. The symbol for a functional dependency is an arrow. X->Y stands for the functional dependence of X on Y. Functional Dependency is a key factor in determining the quality of database architecture.
Determinant refers to the attribute set on the left side of the arrow, X. In contrast, Dependent refers to the attribute set on the right side, Y. While Y will be a dependent non-key attribute from a table that shares the main key with X, X will be the primary key attribute.
It demonstrates the functional dependence between the non-key attribute Y and the primary key attribute X. Simply put if a table's column X characteristic uniquely identifies its column Y attribute. The functional dependence of column Y on column X is symbolized as X->Y.
Functional dependencies are a crucial part of understanding advanced Relational Database System principles since they mathematically represent relationships between database elements.
Example of Functional Dependency in DBMS
Let's see functional Dependency in DBMS with an example.
Assume that the student database has two distinct attributes: Stu Id and Stu Name.
Student ID is Stu_Id.
The student Name is Stu_Name.
The StuId serves as our main key. And in this case, StuId uniquely identifies the StuName attribute. You must first have the StuId if someone wishes to know the student's name. if someone wishes to know the student's name.
Stu_Id | Stu_Name |
---|
011 | Marketing |
022 | HR |
033 | Finance |
044 | Accounting |
055 | Sales |
066 | Telecom |
Stu_Id -> Stu_Name
The functional Dependency between Stu Id and Stu Name mentioned above can be expressed as Stu Id depends on Stu Name.
Rules of Functional Dependency
Source
1. Reflexive Rule: Rule of reflection If Y is a subset of X and X is a set of attributes, then X has a value for Y.
2. Augmentation Rule: If c is set as an attribute and x -> y holds, then ac -> bc also holds. That is the addition of properties without altering the fundamental dependencies.
- For example, X → Y holds true then, ZX → ZY also holds true.
- For example, if { Employee_Id, Name } → { Name } holds true then, { Employee_Id, Name, Age } → { Name, Age }
3. Transitivity Rule: If x > y and y > z are true, then x > z is also true. This rule is quite similar to the transitive rule in algebra. As a functional relationship, X determines Y.
Get In-depth knowledge of core as well as advanced concepts of DBMS with MongoDB Administration training.
Types of Functional Dependencies in DBMS
Following are the types of functional Dependency in DBMS:
1. Trivial Functional Dependency
Every dependent in trivial functional Dependency is a subset of the determinant. To put it another way, a functional relationship is said to be simple if its right-side characteristics are a subset of its left-side attributes. Right-side characteristics are a subset of its left-side attributes.
If Y is a subset of X, the functional relationship X->Y is referred to as trivial.
Example:
Take a look at the Employee table, for instance.
Employee_Id | Name | Age |
---|
1 | Zayn | 24 |
2 | Phobe | 34 |
3 | Hikki | 26 |
4 | David | 29 |
Given that the dependent Name is a subset of the determinant Employee Id, Name, the functional Dependency between
{Employee Id, Name} and {Name} in this case is trivial.
Additionally trivial are Name, Age, and Employee Id. The name is also trivial. Employee Id is trivial.
2. Non-Trivial Functional Dependency
The trivial functional Dependency in DBMS is opposed by it. Formally speaking, dependent if not a subset of the determinant in Non-Trivial functional Dependency.
If Y is not a subset of X, the relationship between X and Y is said to be non-trivial functional. A functional dependency X Y that is not trivial is one in which X is a collection of attributes, and Y is likewise a set of those attributes but not a subset of X.
Example:
Take a look at the Employee table, for instance.
Employee_Id | Name | Age |
---|
1 | Zayn | 24 |
2 | Phobe | 34 |
3 | Hikki | 26 |
4 | David | 29 |
5 | Phobe | 24 |
Because Name(dependent) is not a subset of Employee Id, there is a nontrivial functional dependency between Employee Id and Name in this situation.
The functional dependencies {Employee Id, Name} -> { Age } are likewise nontrivial.
3. Multi-valued functional Dependency
Attributes in the dependent set are not reliant on one another in multi-valued Dependency in DBMS.
If there is no functional dependency between Y and Z, for instance, the relationship X Y, and Z is referred to as multivalued functional Dependency.
Example:
Take a look at the Employee table:
Employee_Id | Name | Age |
1 | Zayn | 24 |
2 | Phobe | 34 |
3 | Hikki | 26 |
4 | David | 29 |
4 | Phobe | 24 |
Since the dependent attributes Name and Age are not functionally dependent (i.e. Name->Age or Age->Name doesn't exist! ), {Employee_Id} -> {Name, Age} is a multivalued functional dependency in this case.
4. Transitive functional Dependency
Given two functional dependencies A –> B and B – >C, A –> C must also exist in accordance with the transitivity principle. A transitive dependency in DBMS is what is being used here.
In transitive functional Dependency, the dependent is thus indirectly reliant on the determinant.
Example:
Take a look at the Employee table, for instance.
Employee_Id | Name | Department | Street Number |
---|
1 | Zayn | CD | 11 |
2 | Phobe | AB | 24 |
3 | Hikki | CD | 11 |
4 | David | PQ | 71 |
5 | Phobe | LM | 21 |
In this case, the relationships between Employee Id, Department, and Street Number are valid. Consequently, Employee Id and Street Number are both valid functional dependencies according to the axiom of transitivity.
How to Denote a Functional Dependency
An "arrow" represents a functional dependency. A B symbolizes the functional dependence of A on B.
An example is a relation with the four attributes A, B, C, and D.
R (ABCD)
A → BCD
B → CD
Attributes B, C, and D are functionally reliant on attribute A in the first functional dependence
A->BCD.
Function dependency B->CD two qualities, C and D depend on attribute B to function.
All elements on the left side of a functional dependency are sometimes referred to as the determinant set, and all of the elements on the right side are the dependant attributes.
- Functional Dependency in DBMS, a diagrammatic representation of functional Dependency,
- The dependent attribute is determined by pointing arrows, and the arrow's origin determines the determinant set.
Advantages of Functional Dependency
The advantages of functional dependency are many. Some of them are listed below:
- The database's data quality is maintained using it.
- It communicates the database design's facts.
- It aids in precisely outlining the limitations and implications of databases.
- It is useful to recognize poor designs.
- Functional Dependency eliminates data duplication in cases where the same values shouldn't appear more than once in the same database table.
- Finding the potential keys in the relationship is the first step in the normalization procedure. Identifying potential keys and normalizing the database without functional dependencies is impossible.
Conclusion
In a DBMS system, functional dependence occurs when one attribute influences another. Keywords for functional Dependency include axiom, decomposition, dependent, determinant, and union.
There are four different types of functional Dependency: 1) Multivalued, 2) trivial, 3) Non-trivial, 4) Transitive. When there are numerous independent multivalued characteristics in a single table, multivalued Dependency occurs.
A set of attributes is said to be trivial if the set of attributes is included in that attribute, which is when the trivial Dependency arises.
When A->B is true, but B is not a subset of A, there is a nontrivial dependency.
A functional dependency is said to be transitive when another functional dependency indirectly creates it. So, now I think that you are clear of functional Dependency.
If you are looking for a complete guide to database management systems, check out MongoDB course.