(1) One-to-many relationship: a department can have multiple employees, and an employee can only belong to one department
Create a foreign key on the more side, pointing to the primary key of the 1 side
(2) Many-to-many relationship
Course-Student
Intermediate table, primary key of curriculum table Primary key of student table
Combined primary key primary key (primary key 1, primary key 2) (two primary keys cannot be repeated)
(3) One-to-one relationship
Either party adds a foreign key, pointing to the primary key of the other party
Foreign key is unique
In general, use a table
(4) Paradigm
The first paradigm: each column is an indivisible atomic item, but there is serious data redundancy, adding data is illegal, deleting data, and violating data integrity
Second normal form: On the basis of the first normal form, non-code attributes must be completely dependent on the code (on the basis of the first normal form, the partial functional dependence of non-primary attributes on the main code is eliminated)
Functional dependence, complete functional dependence, partial functional dependence, transfer functional dependence
Code: In a table, an attribute or attribute group is completely dependent on all other attributes, then this attribute (attribute group) is called the code of the table
Primary attribute: all attributes in the code attribute group
Non-primary attributes: the attributes of the coded attribute group
Third normal form: On the basis of the second normal form, any non-primary attributes do not depend on other non-primary attributes (eliminate transitive dependence on the basis of the second normal form)