Super key, Candidate Key, primary 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

For example, if there is no duplicate name for all people in a small range, consider the following attributes:

ID Card Name gender age

The ID card is unique, so it is a super key
The name is unique, so it is a super key
(Name, gender) is unique, so it is a super key
(Name, gender, age) is unique, so it is a superkey
-- It can be seen that the combination of superkeys is unique, but it may not be the smallest and unique

The ID card is unique and has no redundant attributes. Therefore, it is a candidate key.
The name is unique and has no redundant attributes. Therefore, it is a candidate key.
-- We can see that the candidate key is a super key without any redundant attributes.

To facilitate input query, you can select the ID card as the primary key.
You can also select the name as the primary key.
-- The primary key is a selected candidate key.
 

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.