문제

Say I have the relational schema R(A,B,C,D,E) and one functional dependency A->BCDE. Since the closure of A is ABCDE (i.e. every attribute), it is a superkey; since it is the smallest key not containing any other key, it is also a candidate key.

What if we then add the FD B->A - does this mean that B is a candidate key, or does it mean that A is no longer a candidate key?

My tutor was working through an example and said that a way to determine candidate keys from a set of FDs was to find any attribute that doesn't appear on the RHS of any FD (i.e. any (set of) attribute(s) that isn't implied by any other attributes). Is this necessarily true? If an attribute implies all others but is itself implied by some other set of attibrutes, can it be a candidate key?

도움이 되었습니까?

해결책

If A->BCDE and B->A then A->B->A. Therefore A and B are both candidate keys of R.

Suppose you have a relation R and a set of dependencies F. If you must infer the keys of R only from what is in F then any attribute of R that doesn't appear on the RHS of any dependency in F must be a prime attribute (i.e. part of a candidate key). I expect that is what your teacher meant. That doesn't mean that prime attributes may never appear on the RHS. They may do if there are multiple candidate keys.

다른 팁

Can a candidate key be implied by other attributes?

Candidate keys are implied by the dependencies. That's probably what you meant anyway.

My tutor was working through an example and said that a way to determine candidate keys from a set of FDs was to find any attribute that doesn't appear on the RHS of any FD (i.e. any (set of) attribute(s) that isn't implied by any other attributes).

That doesn't determine candidate keys. It determines the columns that must be part of every candidate key.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top