Number of Possible Super Keys in DBMS

A super key is a set of one or more attributes that uniquely identifies each record in a table. All primary/candidate keys are super keys, but not all super keys are candidate keys (candidate keys are minimal super keys with no redundant attributes).

Key Formulas

Scenario (n = total attributes) Formula
One candidate key with k attributes 2(nk)
Maximum super keys (at least 1 attribute) 2n 1
Two candidate keys (Inclusion-Exclusion) SK(A1) + SK(A2) SK(A1 ∪ A2)
Three candidate keys SK(A1) + SK(A2) + SK(A3) SK(A1∩A2) SK(A1∩A3) SK(A2∩A3) + SK(A1∩A2∩A3)

Examples with Single Candidate Key

Example 1: R{a1, a2, a3}, candidate key = {a1}. Super keys = 2(31) = 4 {a1}, {a1,a2}, {a1,a3}, {a1,a2,a3}.

Example 2: R{a1...an}, candidate key = {a1,a2,a3}. Super keys = 2(n3).

Examples with Multiple Candidate Keys

Example 3: R{a1...an}, candidate keys = {a1}, {a2} ?

= SK(a1) + SK(a2) - SK(a1,a2)
= 2^(n-1) + 2^(n-1) - 2^(n-2)

Example 4: R{a1...an}, candidate keys = {a1}, {a2,a3} ?

= SK(a1) + SK(a2,a3) - SK(a1,a2,a3)
= 2^(n-1) + 2^(n-2) - 2^(n-3)

Example 5: R{a1...an}, candidate keys = {a1,a2}, {a3,a4} ?

= SK(a1,a2) + SK(a3,a4) - SK(a1,a2,a3,a4)
= 2^(n-2) + 2^(n-2) - 2^(n-4)

Example 6: R{a1...an}, candidate keys = {a1,a2}, {a1,a3} (overlapping) ?

= SK(a1,a2) + SK(a1,a3) - SK(a1,a2,a3)
= 2^(n-2) + 2^(n-2) - 2^(n-3)

Example 7: R{a1...an}, candidate keys = {a1}, {a2}, {a3} ?

Using Inclusion-Exclusion:
= 3 * 2^(n-1) - 3 * 2^(n-2) + 2^(n-3)

Practical Example

Example 8: R(A,B,C,D,E,F,G,H) with FDs: CH→G, A→BC, B→CFH, E→A, F→EG. The candidate keys are AD, BD, ED, FD. Applying inclusion-exclusion across all four candidate keys gives 120 super keys.

Maximum Candidate Keys

If any k attributes determine all others, the number of candidate keys is nCk. This is maximized when k = ⌊n/2⌋.

Conclusion

The number of super keys depends on the number of attributes and candidate keys. For a single candidate key with k attributes, use 2(nk). For multiple candidate keys, apply the Inclusion-Exclusion principle to avoid double-counting overlapping super keys.

Updated on: 2026-03-14T22:37:17+05:30

6K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements