The basic concept of database design

Source: Internet
Author: User

About the design of the database in the previous study and self-study has been studied, this time through the study of the soft test in a simple review, the main simple to say a few tests used in the name.

entity, attribute, contact

Entities: Things that can be distinguished from one another objectively. Can be a specific object.

Properties: attribute of an entity, and attribute has a value domain

Contact: The relationship between entities and entities, commonly known as (1:1) (1:N) (n:m).

ER model:




Hyper-key, candidate key, primary key, foreign key , primary attribute , non-primary attribute


Hyper-Key : A property that uniquely identifies a tuple is integrated into a super-key (potentially shifting extra attributes).

candidate Key: an attribute set that uniquely identifies a tuple and does not contain extra attributes becomes a candidate key.

PRIMARY key: The user arbitrarily assigns one of several candidate keys as the primary key.

foreign key: relationship pattern R1, a property set in R2,R1 is a candidate key, but not in R2, is called a foreign key of R2


Main properties: attributes in candidate keys are called primary properties

Non-primary attribute : A property that is not contained in a candidate key in a relational schema is called a non-primary property.


Example:

Relationship mode: Student (school number, name, gender, professional number, age) Condition: Student name not repeat

Super Key (school number, name, gender)

Candidate Key (school number, name)

Primary key: School number or name, but only one.

FOREIGN Key: Professional number

Score (school number, name, course number, score)

Candidate Key: (School number, course number),(name, course number)

Primary key: School Number, course number

Main attribute: School number, name, course number

Non-primary attribute: Score

The primary key belongs to the candidate key, and the candidate key belongs to the Super key.




The basic concept of database design

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.