0

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) ?

Cygnus
  • 3,222
  • 9
  • 35
  • 65
  • No, that's not right. In the first place, {ABCD} is the whole relvar, so {ABCD} is a trivial superkey. What method and web site did you follow? What method is in your textbook? – Mike Sherrill 'Cat Recall' Jan 02 '13 at 17:14
  • @Catcall : here's the link..http://www.techvyom.com/forum/Thread-How-to-find-Candidate-Keys.. Is ABCD right according to that ? Or am I missing something ?? – Cygnus Jan 03 '13 at 09:27
  • 1
    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`. There are two more candidate keys besides A. – Mike Sherrill 'Cat Recall' Jan 03 '13 at 11:26
  • @Catcall : Ohh..!! :/ Do u know where i can find a correct algorithm ? – Cygnus Jan 05 '13 at 10:56
  • Your textbook. Which one are you using? – Mike Sherrill 'Cat Recall' Jan 05 '13 at 11:29
  • @Catcall : Umm..this exactly isnt part of my course-work..its regarding a separate exam that i have to give, and as far as i remember it wasnt done in our course too.. – Cygnus Jan 07 '13 at 07:18
  • Every college-textbook I've seen about database systems included at least one algorithm. Let me see what I can link you to online. – Mike Sherrill 'Cat Recall' Jan 07 '13 at 13:18

2 Answers2

1

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.

Community
  • 1
  • 1
Mike Sherrill 'Cat Recall'
  • 91,602
  • 17
  • 122
  • 185
0

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!

Community
  • 1
  • 1
Lordferrous
  • 678
  • 8
  • 8