OR
A minimal super key is called as a candidate key.
For any given relation,
- It is possible to have multiple candidate keys.
- There exists no general formula to find the total number of candidate keys of a given relation.
Example:
Find the total number of candidate keys for the relation R(ABCDE) with the following
FD={AB-->C, C-->D, B--->E }
Solution:
Consider relation and its FD's
R(ABCDE)
AB-->C, C-->D, B--->E
Eliminate the decencies from in the relation, the reaming attribute is AB and it have only one Candidate key. Check if it find all attributes or not. if not is not a CK.
AB+ ={ A,B,C,D,E}
Therefore AB is a Candidate Key
Example:
Find the total number of candidate key for the relation R(ABCDE) with the following
FD={AB-->C, C-->D, B--->AE }
Solution:
Consider relation and its FD's
R(ABCDE)
AB-->C, C-->D, B--->AE
Eliminate the decencies from in the relation, the reaming attribute is B and it have only one Candidate key. Check if it find all attributes or not. if not is not a CK.
B+ ={ A,B,C,D,E}
Therefore B is a Candidate Key
- There may be more than one candidate keys in a relation.
- First find single attribute closure
- Second two attribute combination closure
- Three attribute combination closure and soon
- If the combination include any candidate it becomes a super key
Example:
Find the total number of candidate keys for the relation R(ABCD) with
FD={A-->CD, D--->A}
Solution:
R(ABCD)
FD={A-->CD, D--->A}
Eliminate the decencies from in the relation, the reaming attribute is B and it have only one Candidate key. Check if it find all attributes or not. if not is not a CK.
B+={B}; Not CK, it can't determine all other attributes. Now we take all combinations of 'B'
AB+={ A,B,C,D} is CK
BC+={B,C} not CK
BD+={B,D,A,C} is CK
If we take three attribute combination
ABC, ABD, BCD since the combinations included candidate key all becomes super keys.
- A candidate key is always a super key
- But a super key can't be a candidate key.
0 comments :
Post a Comment
Note: only a member of this blog may post a comment.