当前位置:网站首页>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]所创,转载请带上原文链接,感谢
边栏推荐
- 实验一作业
- Dynamic query processing method of stored procedure
- MongoDB增删改查操作
- 装饰器(二)
- Wechat applet related
- Aprelu: cross border application, adaptive relu | IEEE tie 2020 for machine fault detection
- 程序员都应该知道的URI,一文帮你全面了解
- EntityFramework Core上下文实例池原理分析
- Case analysis of entitycore framework
- Solve the failure of go get download package
猜你喜欢

Iptables from introduction to mastery

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

Wechat applet related

Dynamic relu: Microsoft's refreshing device may be the best relu improvement | ECCV 2020

An online accident caused by improper use of thread pool

To introduce to you, this is my flow chart software—— draw.io

Development and deployment of image classifier application with fastai

Mongodb add delete modify query operation

为什么需要使用API管理平台

.NET Core 跨平台资源监控库及 dotnet tool 小工具
随机推荐
LeetCode 45 跳跃游戏II
Django之简易用户系统(3)
Brief VIM training strategy
新手入坑指南:工作原因“重启”Deepin系统,发现真的香啊
API生命周期的5个阶段
JVM真香系列:轻松理解class文件到虚拟机(上)
线程池运用不当的一次线上事故
Server side resolution of lengthfieldbasedframedecoder of GetBytes
接口测试用例思路总结
Suffix expression to infix expression
npm install 无响应解决方案
Test comparison of three domestic cloud databases
Introduction and application of swagger
信息安全课程设计第一周任务(7条指令的分析)
进程 线程 协程
RSA非对称加密算法
Mongodb add delete modify query operation
【云服务】阿里云服务器ECS实例规格那么多,如何选型?最佳实践说明
Infix expression to suffix expression
CMS garbage collector