What is the diffrence between Key and Superkey how can we understand ? help me please

hi mertucci,

are in doing data modelling?
Superkey is any subset of attributes that uniquely identifies the tuples of a relation. This subset need not be minimal, that is, one can remove some attributes from it and it is still uniquely identifying. If all redundant attributes are removed you get a subset what is called primary key. A key (better: primary key) is the minimal subset of attributes that uniquely identifies the tuples of a relation, that is, you can't remove further attributes from this subset without losing the property of unique Identification. Therefore, the super superkey (like superman) is always the set of all attributes of a relation.

krs,
tesu

thanks bro

...If all redundant attributes are removed you get a subset what is called primary key...

I have to make an extension:
Sometimes there are more than one superkey of a relation. In such case also all redundant attributes have to be removed and the remaining subsets of attributes are then called CANDIDATE KEYS. Now one can freely select ONE of these candidate keys to identify the relation's tuples. In such case, this selected subset is called PRIMARY KEY.

krs,
tesu

Can i know what is the difference between superkey and primary key?
what is actually candidatekey?

a key is a superkey K such that removal of any attribute from K results in a set of attributes that is not a superkey (does not possess the superkey uniqueness property)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.