Finding Super Keys

How to find a Super Key in a Relation

Consider a relation R(a1, a2, a3,…..an), where n = number of attributes in a relation.
Suppose Candidate Key = (a1)
Find total SKs.

No. of Super Keys = 2^(n-1)

Example 1
R(ABCDE), CK={B}
Find total SKs

Here n…


This content originally appeared on DEV Community and was authored by hebaShakeel

How to find a Super Key in a Relation

Consider a relation R(a1, a2, a3,.....an), where n = number of attributes in a relation.
Suppose Candidate Key = (a1)
Find total SKs.

No. of Super Keys = 2^(n-1)

Example 1
R(ABCDE), CK={B}
Find total SKs

Here n = 5
n-1 = 4
Therefore total number of SKs = 2^4 = 16

Example 2
R(a1, a2, a3,....an), CK={a1a2}
Find total SKs

No. of Super Keys = 2^(n-2), since here there are 2 attributes in the candidate Key.

Example 3
R(XYZMN), CK={ZM}
Find total SKs

Here n = 5
No. of attributes in Candidate Key = 2
Therefore total number of SKs = 2^(5-2) = 2^3 = 8

Example 4
R(a1, a2, a3,....an), CK={a1,a2}
Find total SKs

All SKs which have either a1 or a2 or a1a2
n(a1 U a2) = n(a1) + n(a2) - n(a1a2)

Therfore No. of Super Keys = 2^(n-1) + 2^(n-1) - 2^(n-2)

Example 4
R(A,B,C,D,E,F), CK={A,DF}
Find total SKs

Total number of SKs = 2^(6-1) + 2^(6-2) - 2^(6-3) = 32+16-8 = 40


This content originally appeared on DEV Community and was authored by hebaShakeel


Print Share Comment Cite Upload Translate Updates
APA

hebaShakeel | Sciencx (2021-06-13T09:51:57+00:00) Finding Super Keys. Retrieved from https://www.scien.cx/2021/06/13/finding-super-keys/

MLA
" » Finding Super Keys." hebaShakeel | Sciencx - Sunday June 13, 2021, https://www.scien.cx/2021/06/13/finding-super-keys/
HARVARD
hebaShakeel | Sciencx Sunday June 13, 2021 » Finding Super Keys., viewed ,<https://www.scien.cx/2021/06/13/finding-super-keys/>
VANCOUVER
hebaShakeel | Sciencx - » Finding Super Keys. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/06/13/finding-super-keys/
CHICAGO
" » Finding Super Keys." hebaShakeel | Sciencx - Accessed . https://www.scien.cx/2021/06/13/finding-super-keys/
IEEE
" » Finding Super Keys." hebaShakeel | Sciencx [Online]. Available: https://www.scien.cx/2021/06/13/finding-super-keys/. [Accessed: ]
rf:citation
» Finding Super Keys | hebaShakeel | Sciencx | https://www.scien.cx/2021/06/13/finding-super-keys/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.