Wednesday, 13 April 2022

Finding the Candidate Key of a sub relation using FD's

 It is same as finding candidate key of a relation. instead of checking closure set covers relation we look at closure set covers the sub relation or not.

Example:

For the relation R(ABCD) with FD={ AB-->CD, D-->A}

What are the candidate keys of sub relation R(BCD)

Solution:-

Step-I: Finding the closure of one valued attributes in sub relation

B+={B}, cant derive all the attributes present in the sub relation i.e, BCD, so it is not a candidate key

C+={C}, cant derive all the attributes present in the sub relation i.e, BCD, so it is not a candidate key

D+={D,A}, cant derive all the attributes present in the sub relation i.e, BCD, so it is not a candidate key

Step-II: Finding  closure of two valued attributes in sub relation.

BC+={B,C}, cant derive all the attributes present in the sub relation i.e, BCD, so it is not a candidate key

BD+={B,D,A,C}, can derive all the attributes present in the sub relation, so it is a candidate key

CD+={C,D,A}, cant derive all the attributes present in the sub relation i.e, BCD, so it is not a candidate key

Step-III: Finding the closure of the three valued attribute in sub relation.

BCD+ , not possible, since it'll become the super key of DB.

Therefore the candidate key for the sub relation is {BD}

0 comments:

Post a Comment

Note: only a member of this blog may post a comment.

Find Us On Facebook

Computer Basics

More

C Programming

More

Java Tutorial

More

Data Structures

More

MS Office

More

Database Management

More
Top