当前位置:网站首页>Database design: paradigms and anti paradigms
Database design: paradigms and anti paradigms
2020-11-08 21:14:00 【Let me love you】
- Three paradigms
First normal form (1NF): Every column in the data table ( Each field ) Must be the smallest unit that cannot be split , That is to ensure the atomicity of each column ;

Second normal form (2NF): Satisfy 1NF after , Require all columns in the table , All must depend on the primary key , You can't have any columns that have nothing to do with the primary key , That is to say, a table only describes one thing ;

Third normal form (3NF): The second paradigm must be satisfied first (2NF), requirement : Each column in the table is directly related to the primary key, not indirectly ,( Each column in the table can only depend on the primary key );

The first The first and second paradigms lie in Do you have two tables ,
The second paradigm is that a table contains many different entity attributes , Then it must be divided into several tables ,
The third paradigm is to require It's divided into multiple tables , Then one table can only have... In another table id( Primary key ), There can be no other information ( All other information is queried in another table with the primary key ).
summary :
The first 1 normal form : In each table 1 Column , And this column is the smallest unit that cannot be split No duplicate Columns
The first 2 normal form :1 A watch only describes one thing Properties are completely dependent on the primary key
The first 3 normal form : Use foreign keys for table Association Direct dependence, not indirect ( Pass on ) rely on
It is required that a database table does not contain non primary key information that has been included in other tables .
In short , The third paradigm is that attributes do not depend on other non primary attributes . in other words , If there is a transfer function dependence of non primary attributes on the code , It doesn't conform to 3NF The requirements of
- Anti paradigm
The anti normal form allows the table to have There are transfer function dependencies
The comparison between paradigms and anti paradigms :
When querying records , The normal pattern often requires multiple table joins , The anti normal form only needs to query in the same table , When there's a lot of data , Obviously, the efficiency of the anti paradigm is better .
There's a lot of duplicate data in the anti paradigm , It takes up more memory , You may use more DROUP BY or DISTINCT Time consuming and performance consuming keywords .
When you want When modifying update data ( For example, modify Accounting The head of the Department is Russell), The paradigm is more flexible , And the anti paradigm is Modify all the data , And it's easy to make mistakes .
…
summary : There's a lot of comparison between paradigms and anti paradigms , Each has its own advantages , In the actual development, different patterns should be reasonably mixed according to the needs , To maximize the combination of their respective advantages .
版权声明
本文为[Let me love you]所创,转载请带上原文链接,感谢
边栏推荐
猜你喜欢

Countdownlatch explodes instantly! Based on AQS, why can cyclicbarrier be so popular?

Looking for better dynamic getter and setter solutions

200人的程序员面试经验,都在这里了

Copy the picture

微信小程序相关

Iterm2 configuration and beautification

Constructors and prototypes

给大家介绍下,这是我的流程图软件 —— draw.io

简明 VIM 练级攻略

Suffix expression to infix expression
随机推荐
在Python中创建文字云或标签云
都说程序员钱多空少,程序员真的忙到没时间回信息了吗?
Why need to use API management platform
Realization of file copy
.NET Core 跨平台资源监控库及 dotnet tool 小工具
API生命周期的5个阶段
The road of cloud computing - going to sea - small goal: Hello world from. Net 5.0 on AWS
第一部分——第1章概述
Array acquaintance
Are there many Python application scenarios?
[random talk] JS related thread model sorting
Copy the picture
CountDownLatch 瞬间炸裂!同基于 AQS,凭什么 CyclicBarrier 可以这么秀?
C/C++学习日记:原码、反码和补码
大数据软件学习入门技巧
动态规划之子序列问题解题模板
npm install 无响应解决方案
Introduction skills of big data software learning
200人的程序员面试经验,都在这里了
Five phases of API life cycle