Superkey vs. Candidate key
Let's keep it simple
SuperKey - A set of keys that uniquely defines a row
.So out of all the attributes if even any single one is unique
then all the subsets having that unique attribute falls under superkey
.
Candidate Key - A superkey
out of which no further subset can be derived which can identify the rows uniquely
, Or we can simply say that it is the minimal superkey
.
- Candidate key = minimal key to identify a row
- Super key = at least as wide as a candidate key
For me, a super key would generally introduce ambiguities over a candidate key
candidate key is a minimal superkey
A superkey is a set of columns that uniquely identifies a row. A Candidate key would be a MINIMAL set of columns that uniquely identifies a row. So essentially a Superkey is a Candidate key with extra unnecessary columns in it.