The simplest and easiest to remember explanation of the three paradigms of the database, organize it to facilitate everyone's memory.
There is a lot of talk in the book, which can be summed up in 3 sentences:
1NF: Fields are inseparable;
2NF: There is a primary key, and non-primary key fields depend on the primary key;
3NF: Non-primary key fields cannot depend on each other;
Explanation:
1NF: Atomicity fields cannot be divided, otherwise Not a relational database;
2NF: Uniqueness A table only describes one thing;
3NF: Each column has a direct relationship with the primary key, and there is no transitive dependency;
Examples that do not conform to the first normal form (such a table cannot be created in a relational database):
Table: field 1, field 2 (field 2.1, field 2.2), field 3 ...
Problems: because such a table cannot be designed, there is no problem;
examples that do not conform to the second normal form:
table: learn No., name, age, course name, grades, credits;
this table clearly shows two things: student information, course information;
there is a problem:
data redundancy, each record contains the same information;
delete exception: delete all student grades , delete all the course information;
Insert exception: The student did not choose a course and cannot be recorded in the database;
Update exception: Adjust the course credits, all rows are adjusted.
Correction:
Student: Student (Student ID, Name, Age);
Course: Course (Course Name, Credits);
Course Selection Relationship: SelectCourse (Student ID, Course Name, Grade).
Satisfying the 2nd normal form only eliminates the insertion exception.
Examples that do not conform to the third paradigm:
student number, name, age, college, college contact number, the keyword is a single keyword "student number";
there is a dependency transfer: (student number) → (college) → (college location , college phone)
there is a problem:
data redundancy: there are duplicate values;
update exception: there are duplicate redundant information, and multiple records need to be modified at the same time when modifying, otherwise there will be data inconsistency.
Delete exception
Correction:
student: (student number , name, age, college);
college: (college, location, phone).
Relational database three paradigms explained
Guess you like
Origin http://10.200.1.11:23101/article/api/json?id=327006563&siteId=291194637
Ranking