Super key: the attribute set that uniquely identifies a tuples in a link is called the super key of the link mode.
Candidate Key: A super key without redundant attributes is called a candidate key.
Primary Key (primary key): A candidate key selected as a tuplesProgramPrimary Key
Foreign key: if an attribute set in mode R is a candidate key in other modes, this attribute set is a foreign key (foreign key) for mode R)
That is to say, all attribute sets containing candidate keys are superkeys.
Example: Student Information table
Student ID number name age gender
Student ID: the student ID is unique (uniquely identifies a student record). Therefore, it is a super key and has no redundant attributes. Therefore, it is also a candidate key.
ID card number: it is also unique and super key, and there is no redundant attribute, so it is also a candidate key
(Student ID, name): unique. It is a super key and has a redundant attribute name. It is not a candidate key.
(Student ID, name, age): unique. It is a super key with redundant attribute names and ages, not a candidate key.
-- It can be seen that the combination of superkeys is unique, but it may not be the smallest one. The smallest one is the candidate key or code.
Here we can use the student ID as the primary key, or the ID number as the primary key.
-- The primary key is a selected candidate key.
Question: (student ID card) is the candidate key? Answer: No