Basic Database Theory-Primary Key of the super-key candidate key

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.