[Repost] "High Performance Database" First Speaking: Paradigm Design

zhaozj2021-02-16  128

[Repost] "High Performance Database" First Speaking: Paradigm Design

First lecture: paradigm design

First of all, say, the database is heavy in design, and then it is development. According to the third paradigm, you will enhance you to a new realm!

Noun explanation: third paradigm

The first paradigm: a table that does not contain repeat columns is attributed to the first paradigm.

Second paradigm: If a table is attributed to the first paradigm and only contains columns depend on the primary key, it is attributed to the second paradigm.

The third paradigm: If a table is attributed to the second paradigm and only contains those columns dependent on the primary key, it is attributed to the third paradigm.

Chair3 oral simple explanation:

First paradigm: Table not to design repeat fields

For example: Create Table TB1 (fd1 varchar (20), - used to store phone fd2 varchar (20), - to store phone fd3 int - other)

Then FD1, FD2 violates the first paradigm

Second paradigm:

Second paradigm: Table without the primary key, or there is no unique index

For example, if there is the same amount of data, it is inevitably a violation of the second paradigm.

Third paradigm: Can segment each field.

For example: a table, the original design is:

Create Table Clothes (Clothesid Int Primary Key, - Id Color Varchar (10), - Color Description Varchar (20) - Description)

Then the Color violates the third paradigm.

So, the third paradigm should be designed

Create Table Clothes (CLOTHESID INT Primary Key, - Id ColorId Int, - Color ID Description Varchar (20) - Description)

Create Table Color (ColorId Int Primary Key, Color Varchar (20))

As the primary table, Clothes serves as a subtormat, both of which are interconnected by ColorID.

Benefits of Hanyu Design: Reduce data redundancy, improve system maintainability, and improve system scalability. Disadvantages of the three models: the performance of the database will be reduced. (嘻嘻, but very little, everyone rest assured)

转载请注明原文地址:https://www.9cbs.com/read-8865.html

New Post(0)