Home  >  Article  >  Database  >  Popular understanding of the three major database paradigms

Popular understanding of the three major database paradigms

Guanhui
GuanhuiOriginal
2020-06-02 10:38:515692browse

Popular understanding of the three major database paradigms

Popular understanding of the three major database paradigms

1. Atomicity, which requires attributes to be atomic and cannot be decomposed.

表:字段1、 字段2(字段2.1、字段2.2)、字段3 ......

For example, student (student number, name, gender, date of birth), if you think that the last column can be further divided into (year of birth, month of birth, day of birth), it is not a normal form, otherwise That is;

2. Uniqueness. A table can only explain one thing, that is, the uniqueness of an entity.

表:学号、课程号、姓名、学分;

This table clearly illustrates two transactions: student information and course information; since the non-primary key fields must depend on the primary key, the credits here depend on the course number, and the name depends on the student number, so it does not conform to the second normal form.

There may be problems:

  • Data redundancy:, each record contains the same information;

  • Delete exception : Deleting all student scores will delete all course information;

  • Insertion exception: The student has not selected a course and cannot be recorded in the database;

  • Update exception: Adjusting course credits, all rows adjusted.

Correct approach:

  • Student: Student (student number, name);

  • Course : Course (course number, credits);

  • Course selection relationship: StudentCourse (student number, course number, grades).

3. Redundancy, each column is directly related to the primary key, and there is no transitive dependency.

表: 学号, 姓名, 年龄, 学院名称, 学院电话

Because there is dependency transfer: (student number) → (student) → (college) → (college phone number).

There may be problems:

  • Data redundancy: duplicate values;

  • Update exception: duplicate redundant values When modifying the remaining information, you need to modify multiple records at the same time, otherwise data inconsistency will occur.

Correct approach:

Student: (student number, name, age, college);

College: (college, phone number).

Recommended tutorial: "MySQL Tutorial"

The above is the detailed content of Popular understanding of the three major database paradigms. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn