At present, there are six main paradigms: the first paradigm, the second paradigm, the third paradigm, the BC Paradigm, the fourth normal form and the fifth Paradigm .
Today we only know the basic three paradigms for the time being.
First Paradigm (1NF)
Definition: If the properties of each relationship R of the relationship mode R are non-divided data items , then it is called R is the pattern of the first paradigm.
(That is, for a field in a table to have a unique indivisibility)
For example (Student information sheet):
Student Number name Gender contact
20080901 Three men Email:[email protected],phone:88886666
20080902 li si female email:[email protected],phone:66668888
The above table does not conform to the first paradigm: the Contact field can be re-divided, so the change to correct is:
Student number name Sex email phone
20080901 three men [email protected] 88886666
20080902 li si female [email protected] 66668888
Second Paradigm (2NF)
Definition: If the relational mode R is 1NF, and each non-primary attribute full function depends on the candidate key , then it is called R is the second normal.
To put it simply, the second paradigm satisfies the following conditions: first to satisfy the first paradigm, and then for each non-primary attribute to be fully functional dependent on the candidate key or the primary key.
( for a table to describe is a thing, completely dependent on the primary key, can not just describe a part of the vague things )
For example (students choose a timetable):
Student curriculum teacher teacher Title textbook class time
John Doe Spring Zhang teacher Java lecturer "Spring in the" 301 08:00
Zhang San struts yang teacher Java lecturer "Struts in Action" 302 13:30
Here (students, courses) can determine teacher, teacher title, textbook, Classroom and class time, so you can put (students, courses) as the primary key. However, the textbook is not entirely dependent on (students, courses), only take out the course to determine the teaching material, because a course, must have designated a teaching material. This is called incomplete dependency, or partial dependency. In this case, the second paradigm is not satisfied.
After the change, select the timetable:
Student Curriculum teacher Teacher Title class time
John Doe Spring Zhang teacher Java Lecturer 301 08:00
Zhang San Struts yang teacher Java Lecturer 302 13:30
Curriculum:
Course Materials
Spring "Spring in the Bible"
Struts in Action
Third Paradigm (3NF)
Definition: If the relationship mode R is 2NF and all the non-primary attributes in the relational mode R (u,f) have no transitive dependencies on any candidate keywords , then the relationship R is the third paradigm.
(for a relationship between a table and a table, there can be no dependency between the table and the table.) Can only rely on the primary key, that is, a table can only describe one thing )
In the above example, in the selected timetable, a teacher can determine a teacher's title. In this way, teachers rely on (students, courses), and the teacher's title is dependent on teachers, which is called transmission dependence. The third paradigm is to eliminate transitive dependencies.
After the change, select the timetable:
Student Course Teacher Classroom time
John Doe Spring Zhang 301 08:00
Zhang San Struts yang teacher 302 13:30
Teacher Table:
Teachers ' titles
Teacher Zhang, Java lecturer
Teacher Yang, Java lecturer
In this way, the title of the new teacher is not selected in the course of time also have a place to save, no candidate this teacher's class when the teacher's title is not deleted, modify the teacher title when the teacher can only modify the table.
To put it simply,
The first paradigm is atomicity, and the field cannot be separated.
The second paradigm is full dependence, no partial dependence;
The third paradigm is that there is no transitive dependency.
Three paradigms of database design