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