You are watching: Difference between superkey and candidate key
Every candidate vital is a super key but, every super key may or might not it is in a candidate key. There countless other distinguishing factors between super vital and candidate key, i beg your pardon I have briefly discussed in the comparison graph below.
Content: Super vital Vs Candidate Key
|Basic||A solitary attribute or a set of features that uniquely identifies all attributes in a relationship is at sight key.||A proper subset of a super key, i m sorry is likewise a super crucial is a candidate key.|
|One in other||It is not compulsory the all super tricks will it is in candidate keys.||All candidate tricks are supervisor keys.|
|Selection||The collection of at sight keys forms the basic for choice of candidate keys.||The set of candidate keys form the basic for an option of a solitary primary key.|
|Count||There room comparatively more super keys in a relation.||There space comparatively much less candidate secrets in a relation.|
Definition of supervisor key
A super key is a basic crucial of any relation. The is defined as a key that can identify every other features in a relation. Super vital can be a solitary attribute or a collection of attributes. Two entities do not have actually the very same values because that the qualities that create a at sight key. There is at least one or an ext that one super secrets in a relation.
A minimal super vital is additionally called candidate key. Therefore we have the right to say several of the at sight keys get verified because that being a candidate key. We will check out later just how a superkey is checked to end up being a candidate key.
Let us take a relation R (A, B, C, D, E, F); us have adhering to dependencies for a relationship R, and also we have checked each for being at sight key.
But utilizing a an essential CB we can only uncover values for attribute D and F, we have the right to not uncover the value for qualities A and E. Hence, CB is no a supervisor key. Very same is the case with crucial D we deserve to not uncover the values of all qualities in a table using crucial D. So, D is no a super key.
Definition that Candidate Key
A super key that is a proper subset of an additional super an essential of the same relationship is called a minimal supervisor key. The minimal super key is dubbed Candidate key. Favor super key, a candidate vital also identifies each tuple in a table uniquely. A candidate key’s attribute deserve to accept NULL value.
One that the candidate tricks is liked as primary crucial by DBA. Provided, the the crucial attribute values have to be unique and also does no contain NULL. The attributes of Candidate crucial is called prime attributes.
In over example, us have found the Super keys for relation R. Now, permit us check all the super keys for gift Candidate key.
Similarly, a super key DF is also a ideal subset that super vital DEF. So, when DF is alone capable of identify all features in a relation why perform we need DEF. Hence, super key DF becomes a candidate key while DEF is only a supervisor key.
The super key CD is no a suitable subset of any other at sight key. So, we can say CD is a minimal super key that identifies all qualities in a relation. Hence, CD is a candidate key.
Whereas an essential CB and D room not super vital so, they have the right to not it is in the candidate vital even. Viewing over table you can conclude that each candidate crucial is a super crucial but the station is not true.
Key Differences in between Super Key and Candidate KeyA single attribute or a collection of qualities that have the right to uniquely recognize all features of a particular relation is called Super key. ~ above the various other hands, a super key that is a proper subset of one more super crucial is called candidate key.All candidate secrets are at sight keys however the train station is not true.The set of super secrets is proved to uncover candidate tricks whereas, the set that the candidate keys is confirmed to choose a single primary key.Super keys are comparatively more in number than candidate keys.
See more: Can A Gas Stove Run On Propane Conversion: The Facts You Need To Know
Super key is a basic key of any relation. They have to be plotted an initial before recognizing other keys for the relation as they type the base for other keys. Candidate key are vital as it helps in recognizing the many important key of any relation the is a main key.