What is a code, main code, primary attribute, non-primary attribute
Source: Internet
Author: User
Code: Symbol representing number
Main code when we build the database, we need to specify a master code for each table, and the main code is called the primary key.
The so-called main code is the candidate code that distinguishes different entities in the entity set.
There can be only one master code in an entity set, but there may be multiple candidate codes.
Two points must be noted:
1. The main code must be chosen carefully.
For example: the name of the person is not the master code, because there may be more than one person, and the ID card can be the master code.
2. The selection of the main code should be those that are never or rarely changed.
For example: A person's address should not be part of the main code, because it is likely to change
Candidate code if the value of an attribute group in a relationship can uniquely identify a tuple, and any of its true subsets can no longer be identified, the attribute group is called a candidate code.
For example: In the student entity, the "learning number" is the only distinction between the student entity, but also assume that the "name", "age" attribute combination is enough to distinguish the student entity, then {study number} and {name, age} are candidate code
The main attribute contains the property called Primary attribute in any of the candidate keywords.
Properties that are not contained in the main code are called non-primary properties.
A non-primary property is defined relative to the primary attribute.
For example: In the relationship-student (school number, name, age, gender, Class), the main code is "school Number", then the other "name", "Age", "Gender", "class" can all be called non-main attributes
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.