Functional Dependency with Example in Database Management System
In this lecture we are going to know details about functional dependency. If you don't know what is Functional Dependency in Database Management System then first please read this article.
What is Functional Dependency ?
Suppose "S" is a database name and it has a table name "X". Let it has two attributes "A" and "B" in this table. Now if B is an attribute that is functionally dependent on another attribute A that has two records whose values are the same, then the value of the B attribute of two records must be same. Hope you will understand.
It is functionally written like this:
A -> B that is, B depends on A. You can also say that A Determines B. Here A is called determinant and B is dependent.
Having trouble understanding? Notice the table below.
Suppose X and Y are two attributes with two records. Now say this table is a functionally dependent or not? The answer is no because we have already said that if the values of A are the same, then the values of B must be the same. But here the value of Y is different. So there is no X -> Y functional dependency.
There is an easy way to figure it out. Just think if I ask you what is the value of Y to the respect of A? You can't tell because the values of Y here different to the respect.of A.If both were 1 then you could easily tell that the value is 1. So keep in mind that functional dependency exists in those values whose search is possible to identify values otherwise not. Remember that this work is not theoretical statement it is just a means of figuring out the easel.
Now we will look at a big example and try to find out who has functional dependency and who doesn't. Notice the table below with great attention
Now we will see that some of the above equations have functional dependencies.
A → BC : Look at it, for A , every value of BC is the same. And in a cell that doesn't have a same value , the value of A is also different in that room. So it's in our rules.That is for the same value of A , BC must have same values. And for different values of A, BC can have different values or same values.I hope you understand.
DE → C: Look at here, for same values of DE , C also contains same value and the same value of C for the different values of DE. So it also satisfies our rules. So we can say it is also functionally dependent.
C → DE: Look at here all values of C are the same .That's mean all the values of DE must be same. But here it is not. So there is no functional dependency here.
BC→ A: Look at it for the seam value of BC , A also have same values and different for different values. So there is functional dependency.
I hope you have been able to understand very clearly.
Codechief is a very fast growing community among programmers and have a reach of around 1 million+ readers globally. Contribution at Codechief is open for all those who have a passion to learn and help others by sharing their knowledge. If you think you have the zeal to learn, start contributing on Codechief contribute. you can also mail your article to [email protected] See your article appearing on the codechief main page and help other code.
We believe that everyone has the right to learn, so we allow both students and professionals to contribute on Codechief.Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
Was this article helpful?