当前位置:网站首页>On the three paradigms of database design

On the three paradigms of database design

2022-04-23 20:45:00 Jan York

My blog icon-default.png?t=M3C8https://www.ideaopen.cn/

normal form ?

Namely specification !

* The paradigm is “ A set of relational patterns that conform to a certain level , Indicates the degree of rationalization of the relationship between attributes within a relationship ”. * It's obscure, isn't it ? In fact, you can roughly understand it as the level of some design standard that the table structure of a data table conforms to .

The database paradigm is also divided into 1NF,2NF,3NF,BCNF,4NF,5N Generally when we design a relational database , At best, consider BCNF Is enough .

Design that conforms to the higher paradigm , Certainly Conform to the lower paradigm , For example, in line with 2NF Relationship model of , It must be in line with 1NF.

1NF- First normal form

Each column of the data table should maintain its atomic properties , That is, columns can no longer be split .

Such as this :

Stock it can also be divided into the quantity of stock , Purchase price and other attributes . So this is not in line with the first paradigm .

come from ——> Blog Garden

2NF- Second normal form

Second normal form (2NF) It's in the first paradigm (1NF) Based on , That is to meet the second paradigm (2NF) We must first satisfy the first paradigm (1NF).

  • That is to meet the premise of the first paradigm , When There are multiple primary keys When , That's what happens when it doesn't fit the second paradigm !!!.
  • For example, there are two primary keys , There can't be such an attribute , It only depends on one of the primary keys , This is not in line with the second paradigm .
  • The popular understanding is that any field only depends on the same field in the table .

rely on

In the data sheet , attribute ( Attribute group )X In certain cases , Can completely exit the attribute Y Depend entirely on X.

Completely dependent on

Complete dependency is for attribute groups , When a set of attributes X Can push it out Y Say when you are Y Depend entirely on X.

Part of it depends on

A set of attributes X One or more of the properties in can deduce Y Just say Y Depend in part on X.

3NF- Third normal form

First , To meet the third paradigm (3NF must First satisfy the second paradigm (2NF).

in other words , Require a database table It doesn't contain Already included in other tables Non primary key Field .

Three paradigms must be ?

Our three paradigms are general norms . That is to say , It's just that I usually follow this specification .

however !!! It doesn't have to be observed , For example, sometimes , It's not a good thing that data is not redundant . therefore , We need to define , Build on requirements .

No redundant database is not necessarily the best database , Sometimes in order to improve operation efficiency , Improve reading performance , We must lower the standard of paradigm , Keep redundant data in place .

Other paradigms

BCNF-BC normal form

Relationship model R<U,F> in , If every determinant contains a code , be R<U,F> Belong to BCFN.

namely :

  1. All non primary attributes are fully function dependent on each code ;
  2. All primary attributes are also fully function dependent on each code that does not contain it ;
  3. No attribute completely depends on any set of non code attributes .

4NF- Fourth normal form

It is not allowed to have nontrivial and non functional multivalued dependencies between attributes of relational schema .

5NF- The fifth paradigm

  • The fourth paradigm must be satisfied .
  • Tables must be decomposable into smaller tables , Unless those tables logically have the same primary key as the original table .

Generally when we design a relational database , At best, consider BCNF Is enough .!!!

版权声明
本文为[Jan York]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204232039375929.html