boyce codd and finding candidate keys

310 views Asked by At

needing desperate help with understanding boyce codd and finding the candidate keys. i found a link here http://djitz.com/neu-mscs/how-to-find-candidate-keys/ which i have understood for most part but i get stuck

e.g

(A B C D E F)

A B → C D E

B C D → A

B C E → A D

B D → E

right as far as i understand from the link i know you find the common sets from the left which is only B, and common sets from the right which are none

now where do i go from here? i know all candidate sets will have B in them but i need guidance on finding candidate sets after that. someone explain in simple language

2

There are 2 answers

0
Mike Sherrill 'Cat Recall' On

The linked article isn't written particularly well. (That's an observation, not a criticism. The author's first language isn't English.) I'll try to rewrite the algorithm. This isn't me telling you how to do this. It's my interpretation of how the original author is telling you to do this.

  1. Identify the attributes that are on neither the left side nor right side of any FD.
  2. Identify the attributes that are only on the right side of any FD.
  3. Identify the attributes that are only on the left side of any FD.
  4. Combine the attributes from steps 1 and 3.
  5. Compute the closure of the attributes from step 4. If the closure comprises all the attributes, then the attributes from step 4 make up the only candidate key. (No matter how many candidate keys there are, every one of them must contain these attributes.)
  6. Identify the attributes not included in step 4 and step 2.
  7. Compute the closure of the attributes from step 4 plus every possible combination of attributes from step 6.

So for the FDs you posted, you'd end up with this.

  1. {F}
  2. {}
  3. {B}
  4. {BF}
  5. The closure of {BF} is {BF}. That's not all the attributes. (But every candidate key must contain {BF}.)
  6. {ACDE}
  7. Compute the closure of these sets of attributes.
    • {ABF}
    • {CBF}
    • {DBF}
    • {EBF}
    • {ACBF}
    • {ADBF}
    • {AEBF}
    • {CDBF}
    • {CEBF}
    • {DEBF}
    • {ACDBF}
    • {ADEBF}
    • {CDEBF}

If I got those combinations right, every candidate key will be found among the possibilities in step 7. In your example, there are 3 candidate keys.

0
Ahmed On

http://www.sroede.nl/projects/fdhelper.aspx

this would help'just put in ur relation and FD's click generate at the bottom