The Gateway to Computer Science Excellence
+24 votes
2.3k views
The maximum number of superkeys for the relation schema $R(E,F,G,H)$ with $E$ as the key is _____.
in Databases by Veteran (106k points) | 2.3k views
0
wht if EF is candidate key then what will be formula?
+2
There is no need to cram any formula. The thing is if we take EF as the candidate key then any superset of other attributes(G, H) will also come under super key.with 2 attributes total 4 possibilities are there.First is either both of them should be present, or one of them is present or none of them should be present.

So total EF as candidate key, the total number of superkeys possible = 4 {EF, EFG, EFH, EFGH}
0
E __  __  __

For other attributes, there are two choices. So, $2^3=8$

7 Answers

+41 votes
Best answer

Super Key is any set of attributes that uniquely determines a tuple in a relation.

Since $E$ is the only key, $E$ should be present in any super key.

Excluding $E$, there are three attributes in the relation, namely $F, G , H$. Hence, if we add $E$ to any subset of those three attributes, then the resulting set is a super key. Number of subsets of $\{F, G, H\}$ is $8$. Hence the answer is $8$.

The following are Super Keys: $$\left \{ \substack{E\\EF\\EG\\EH\\EFG\\EFH\\EGH\\EFGH} \right \}$$

by Boss (11k points)
selected by
0
please tell me how you find all the keys without functional dependencies ???
0
where does the statement say E is the only key?
0

@Sankaranarayanan P.N @amarVashishth

It is possible to have super key without including primary key, We have such examples too-

Then how u assumed here that no other attributes can make super key. Is there any standard/rule for that ?

Example of student table having S.id as primary key:

S.id    S.name    S.age    S.sem

1           A             18             I

2           B             19            II

3           A             20            III

4           C             21            II

So, here (S.name,S.age) can act as a super key.

Means we have super key without including primary key also. Isn't it?

Then there may exist more than 8 super keys.

Please explain if i went wrong.

 

0

@Kuljeet Shan

A superkey is defined to be the set of attributes in a relation which can uniquely identify every tuple in the relation. 

A candidate key( primary key or alternate keys) is a minimal super key.

If a set of attributes can uniquely identify every tuple in a relation, then it becomes a super key. But if there exists a subset of attributes in super key then that forms the candidate key.

if there exists no subset in superkey, then that superkey itself becomes minimal superkey and hence a candidate key.

in your table, S.name and S.age becomes super key but it includes a candidate key S.age. Here S.age can also uniquely identify every tuple.

S.age is candidate key and (S.name , S.age) is super key.

On the other hand, if neither S.name nor S.age can uniquely identify every tuple, then (S.name,S.age) is candidate key as well as super key.

CONCLUSION: 

Super key always includes candidate keys, may be primary key or alternate keys.

0

@SuvasishDutta you are taking about s.age is candidate key, it is in this table. Suppose age of "C" is 18 then what ?

Then (S.name, S.age) is super key without including either primary or candidate key, can uniquely identify every tuple.

Now, what about your last line as conclusion"Super key always includes candidate keys, may be primary key or alternate keys." ?

0
Then (S.name,S.age) becomes candidate key as well as super key.

Yes either super key is same as candidate key or it contains candidate key always.

Plz verify.
+21 votes
total number of super keys = $E$ has to be included it is must $\times$ for each attribute we have $2$ choices include it or don't

$\text{Total number of Super keys } = 1 \times 2 \times 2 \times 2 = 8$
by Boss (30.8k points)
+10 votes

E is the key so E must be included for the rest 3 we can take 0 or 1 or 2 or 3 so 3C0+3C1+3C2+3C3=1+3+3+1=8

by Active (4.1k points)
+6 votes

Maximum no. of possible superkeys for a table with n attributes = 2^(n-1) Here, n = 4. So, the possible superkeys = 24-1 = 8 The possible superkeys are : E, EH, EG, EF, EGH, EFH, EFG, EFGH

by Boss (10k points)
0

@amarVashishth @Shaik Masthan

Sir,

what this formula says i didn't get it:

Maximum no. of possible superkeys for a table with n attributes = 2^(n-1) 

what i know or i can drive ,let say there are 4 attribute for a relation R is 

{E, F, G, H} (note that  i do not give any restriction here)

the possible number of super keys

include only one attribute -> 4C1 = 4.  => {E, F, G, H}

including two attribute 4C2 = 6. => {EF, EG, EH, FG, FH, GH}

including three and four 4C3 = 4 and 4C4 = 1. => { EFG, EGH, EFH, FGH} and {EFGH}

total possible SK's turns out to be = 15 so we can say ( 2^n) -1 where n-> #of attributes in the Relation R,

since they said clearly all super keys those includes E (E already a key in R)

 then we takes all super keys those includes E isn't it ?

and it is also possible that without including key attribute we can also form super keys

eventually  $\LARGE keys\subseteq candidate_keys \subseteq super_keys$

Correct me sir if i'm wrong, for correctness of my approach !

+3 votes

THE BEST METHOD FOR CALCULATING NO OF SK's:

total no of sk's= (# sk's over prime attributes) *  (2^#no of non-prime)

total no of sk's= 1*(2^3)

total no of sk's=8

by Active (4.5k points)
edited by
0

@rajoramanoj

can u  explain derivation  of this formula !!! it will be help in depth knowledge of finding sk

+1 vote
Given E is the key,So if we add any element  with E it will become super key. Now we have 3 element F,G,H. for each element we have 2 option either to include it or not to include it . So resulting no. of superkey is 2 * 2 * 2= 8
by (87 points)
–6 votes
15 super keys are possible with E as compulsory attrubite we can add any number of attrubuts from 3 of them.

If we add one of them = 3

If we add two of them = 3*2

If we add 3 of them = 3*2
by Active (3.4k points)
+1
How come 15?

The answer would be 8.
Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,832 questions
57,686 answers
199,273 comments
107,204 users