Home > Database > Mysql Tutorial > Popular understanding of the three major database paradigms

Popular understanding of the three major database paradigms

Guanhui
Release: 2020-06-02 10:38:51
Original
5778 people have browsed it

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 ......
Copy after login

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.

表:学号、课程号、姓名、学分;
Copy after login

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.

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

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template