문제

For a relation {A,B,C,D} with the following functional dependancies -

A -> BCD
B -> C
CD -> A

Using a particular method i found on one of the sites, i am getting the candidate key as ABCD. Is that right ? What is the correct candidate key(s) ?

도움이 되었습니까?

해결책

ABCD is a trivial superkey. Every algorithm has to generate ABCD. But ABCD isn't a candidate key in this relation. By definition, a candidate key is a minimal superkey.

You can tell the algorithm in your link is inadequate by simple inspection. It doesn't generate A as a candidate key, but you're given A -> BCD, so A is clearly a candidate key. There are two more candidate keys besides A.

This SO answer by @ErwinSmout describes an algorithm that's suitable for pencil and paper. Most textbooks include algorithms that are suitable for automation.

다른 팁

Lets make it simple: Here is a definition for Super,candidate keys

Super Keys

Super key stands for superset of a key.

A Super Key is a set of one or more attributes that are taken collectively and can identify all other attributes uniquely.

Candidate Keys

Candidate Keys are super keys for which no proper subset is a super key.

In other words candidate keys are minimal super keys.

By Closure property, we get

A+=ABCD

since

A->BCD given

A->A reflexivity rule

Thus A is the Candidate key.

Hope this helps!

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