How to Find Super Key From Functional Dependencies Let R be the relational schema, and X be the set of attributes over R. If X+ determine all the attributes of R, then X is said to be superkey of R. To Identify Super keys, we need to follow some steps –
- Compute Closure for the attributes of combination of attributes on the LHS of Functional Dependency i.e. Determinants.
- If any closure includes all the attributes, then that can be declared as a key for the table.
To Identify Super Key –
For Example :Let R(ABCDE) is a relational schema with following functional dependencies. AB → C DE → B CD → E
Step 1: Identify the closure of LHS of FD - (AB)+ = ABC (DE)+ = DEB (CD)+ = CDE = CDEB {as DE → B} No SuperKey Found in step 1.
Step 2: If no super Key found from step 1, then follow step 2 to find a new key by applying augment rule. Apply Augment rule until all attributes are mentioned in the closure result. So, choosing (CD)+ as it contains more attributes than others one i.e. CDEB, (ACD)+ = ABCDE {By augment Rule} Hence (ACD)+ determines all the attributes of R. So ACD is a SuperKey. As ACD is a super key, we make the combination of remaining attributes with ACD. So, superkeys are - ACDB, ACDE, ACDBE.
Step 3: Follow step 3 to Identify more superkeys from new SuperKey (ACD) by applying Pseudo Transitive rule - Check the other Functional Dependencies in which the LHS is a subset of new super key, and that on its RHS contains some other attribute of new superkey. There is only one i.e. AB → C, Remove the attributes of the RHS of these from new superkey. Doing so gives you a key, that are certainly superkeys, but not necessarily irreducible ones: A(AB)D = ABD : SuperKey Other Super Keys will be ADBE, ABDC, (Already Found) ABDCE. (Already Found) Repeat the procedure again for the new superkey(ABD) till we get all superkeys.
Step 3 Continued... (To find SuperKey from ABD) For ABD, We have a functional dependency again i.e. {DE → B}. So, A(DE)D = ADE : SuperKey Other Super keys will be - ADEB, (Already Found) ADEC, (Already Found) ADEBC. (Already Found)
Step 3 Continued... (To find SuperKey from ABD) For ADE, ⇒ CD → E, So, AD(CD) = ACD : SuperKey that we already haveSo all the superkeys for R will be – ACD, ACDB, ACDE, ACDBE ABD, ABDE, ADE. ]]>