database theory - candidate keys from functional dependencies -
given relation r attributes abcde. given following dependencies: -> b, bc -> e, , ed -> a. have answer cde, acd, , bcd. need know how it. thanks.
a candidate key minimal superkey. in other words, there no superflous attributes in key. first step finding candidate key, find superkeys. unfamiliar, super key set of attributes closure set of atributes. in other words, super key set of attributes can start from, , following functional dependencies, lead set containing each , every attribute.
since have functional dependencies: -> b, bc -> e, , ed -> a, have following superkeys:
- abcde (all attributes super key)
- bced (we can attribute through ed -> a)
- acde (just add b through -> b)
- abcd (just add e through bc -> e)
- acd (we can b through -> b, , can e through bc -> e)
- bcd (we can e through bc -> e, , ed -> a)
- cde (we can through ed -> , b -> b)
(one trick here realize, since c , d never appear on right side of functional dependency, every key must include both c , d)
now have our super keys, can see last 3 candidate keys. since first 4 can trimmed down. cannot take attributes away last 3 superkeys , still have them remain superkey.
thus candidate keys are: acd, bcd, , cde.
hope helps,
Comments
Post a Comment