Candidate key
is a super key
from which you cannot remove any fields.
For instance, a software release can be identified either by major/minor version, or by the build date (we assume nightly builds).
Storing date in three fields is not a good idea of course, but let's pretend it is for demonstration purposes:
year month date major minor
2008 01 13 0 1
2008 04 23 0 2
2009 11 05 1 0
2010 04 05 1 1
So (year, major, minor)
or (year, month, date, major)
are super keys (since they are unique) but not candidate keys, since you can remove year
or major
and the remaining set of columns will still be a super key.
(year, month, date)
and (major, minor)
are candidate keys, since you cannot remove any of the fields from them without breaking uniqueness.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…