Transcript for:
Minimal Cover of Functional Dependencies

hi everyone welcome back to my YouTube channel I am RTI and I'm back with another lecture in the dbms series so in the last lecture we learned about equivalence of functional dependency in this particular video we would be learning about minimal cover of functional dependencies so without any further Ado let's get started now what is this minimal cover of functional dependency and why do we even need it so it is a simplified version of the original set of functional dependencies it help us to remove redundant functional dependency so consider if we have a functional depend a determine b b determine C and A determine C so here we can see from the rule of transitivity we can conclude that a will determine C so do we need to have a redundant functional dependency which tell us about this no right so we can remove the Redundant functional dependency because from the existing functional dependency this particular functional dependency could be derived so it help us to remove the Redundant functional dependency coming to the second point it reduces the complexity of functional dependency so lesser the functional dependency the complexity is also reduced so we can say that it help us in reducing the complexity third is it ensures that there are no unnecessary dependencies which can lead to anomalies in database operations such as insertion deletion and updation so from this functional dependency consider a determines B if a is a candidate key Super Key then there are very less anomalies but if a is a non-prime attribute then there are many anomalies which are introduced in the database so it ensures that there is no unnecessary dependencies and the anomalies are also lesser now let's see that how we can find the minimal cover of a functional dependency so Step One is we have to decompose the functional dependency that is rhs if there is X determines AB then it can be return as X determine a and X determine B so that we can know that which all functional dependencies are redundant so from the rule of decomposition we have learned that if in rhs there are two set of attributes or a combination of attributes that can be decomposed in a X determine a and then X determine B but it doesn't happens with the LHS because LHS is a part of candidate key or key which determines this particular attribute dependent can be broken down but determinant can't be broken because that combination is determining this particular dependent so we can broke the dependent so here A and B is broken into X determine a and X determine B now coming to step two so we have to remove the Redundant functional dependency now how we will find that which fun fun dependency is redundant so first is make a new functional dependency set excluding the one you feel is redundant so consider if there are three functional dependencies which are present A B and C for now you can consider this or you can consider this as well a determine b b determine C and C determine D so what we will do is consider right now I'm feeling that this particular functional dependency is redundant so what I'll do is I'll make a new functional dependency set which will be having only B determine C and C determine D now second step I'll find find the closure of LHS from the rest of the functional dependency and see if it determines all the attributes of table so what I'll do is I'll find the attribute closure of this particular LHS a closure and then I'll see if this is getting determined from these particular functional dependency which is existing if this happens then we can exclude this functional dependency if this a closure does not have the attribute which is getting determine then we can say that this one is not redundant so if yes you can remove that if no then jump to the next one so now we can go to B determine C we can make a new functional set which is having a determine B and C determine D and then we can take the closure of B and we can see that if from these two functional dependency B is determining C or not if it is happening then we can exclude this if it is not happening then we have to include this now the step three is we have to remove the unnecessary attributes from LHS so earlier we removed the unnecessary attribute or you can say we have decomposed the attributes of rhs now we have to also remove the unnecessary attributes from LHS consider if there is AB determining X so we have to see that if any of the attribute is unnecessary like this alone can determine all the attributes in the functional dependency so this could be ignored if this alone can determine all the attributes in the given functional dependency set then this could be ignored so we have to see that if the determinant is a Super Key it can be reduced to a candidate key so consider if AB is a Super Key so candidate key is basically a minimal version of super super key so we have to see that if this version of Super Key can be minimal and we can get the candidate key so we can see that if B alone can determine all the attribute or if a alone can determine all the attribute and then we can remove this so candidate key is basically a minimal super key so let's understand from an example so consider we have to find the minimal cover of the functional dependency a determines BC B determines C A determine B A determine C so let's follow the step so the step one is we have to decompose the functional dependency rhs basically we have to decompose the dependent where if x is determining a we can write it as X determine a and X determine B so let's see if there is any combination which is present in the rhs so yes here we can see that a is determining b c so we can write it as a determine B A determine C now coming to here so rhs is not having two attributes so we can skip this coming to here dependent is not having two attributes we can skip this coming here there are two attributes or combination of attributes but it is present in LHS and we have to see for rhs so rhs there is single attribute so now the functional dependency set would be a determine B A determine c b determine C A determine b and a b determine C but here you can see that a determine B A determine B is occurring twice so we can remove that as well because this is just a duplicate functional dependency so the final one will be a determine B A determines c b determines C and A determines C so the step two is we have to remove the Redundant functional dependency for this we have to make a new functional dependency set excluding the one you feel is redundant so we'll go one by one first we feel that a determine B is redundant so I'll write it a determine B for now we are thinking is redundant so we'll make a functional dependency which would be excluding this so if I exclude this I'll be left with a determine c b determine C and A determine C this is my new functional dependency set now we have to find the closure of LHS from the rest of the functional dependency and see if determines all the attributes of table if if yes you can remove that if no jump to the next one so first we will find the closure for this LHS that is a so a closure here will give me a determine C so c will be there and nothing else a can determine itself so a closure is giving me a and C but since a closure does not have all the attributes we shouldn't discard this since a closure is not giving me all the attributes we shouldn't discard this because right now it's not identifying all the attribute now we are considering a determine C is the Redundant one so we will have this a det C so the new functional dependency set would be a determine b b determine C and A B determine C now we have to find the closure for the LHS that is a determine C so a closure now here a will be giving me a a will be giving me B and B will be giving me c so now a closure is determining all the attributes which is present in the table so a determine C can also be determined from a determine B and B determine C so since a closure is having all the attributes and we can discard this so we will be discarding this from the final functional dependency set so now we are left with only a determine b b determine C and A determine C now coming to Third B determine C so now for B determine C since we have discarded this we will be only having two functional dependency a determine b and a determine C so a determine B A determine C now we'll take the closure of the LHS for the functional dependency which we are discarding so B closure will be having only B so since B closure does not have all the attributes we shouldn't discard this if B closure would be having all the attributes then it would definitely Define but since it is not having all the attributes this particular dependency can't be discarded so we will not discard this coming to the final functional dependency that is AB determin C so for ab determine C we will discard this and we will have new functional dependency set as a determine B and B determine C so a determine b b determine C we are having so we'll take the closure of LHS that is AB and ab closure gives me a B and B will give me c so since a closure is having all the attributes we can discard the this as well so we will discard this also from the final result so from the final result we can see a determine B and B determine C is the minimal cover for this particular functional dependency so in this way we find the minimal cover so here you can see that we don't need to go to step three because we have to remove unnecessary attributes from LHS but in LHS there is only one attribute so we don't need to go for step three where we are removing unnecessary attribute this was all about minimal cover of functional dependency in this particular video I hope you like this video so if you like this this video please hit the like button if you're someone who is new to my channel can go ahead and watch out the tech content first and if you find it useful can go ahead and subscribe also if you have not followed me on my social media handles you can go ahead and follow the links are in the description till then take care keep learning keep growing keep smiling bye all