当前位置:网站首页>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]所创,转载请带上原文链接,感谢
边栏推荐
- Mongodb database
- 寻找性能更优秀的动态 Getter 和 Setter 方案
- 使用基于GAN的过采样技术提高非平衡COVID-19死亡率预测的模型准确性
- 使用Fastai开发和部署图像分类器应用
- abp(net core)+easyui+efcore实现仓储管理系统——出库管理之五(五十四)
- Development and deployment of image classifier application with fastai
- C/C++学习日记:原码、反码和补码
- Five design schemes of singleton mode
- 数组初相识
- Queue with two stacks
猜你喜欢
Dynamic relu: Microsoft's refreshing device may be the best relu improvement | ECCV 2020
如何让脚本同时兼容Python2和Python3?
寻找性能更优秀的不可变小字典
动态规划答疑篇
Realization of file copy
实验一作业
存储过程动态查询处理方法
Creating a text cloud or label cloud in Python
Dynamic ReLU:微软推出提点神器,可能是最好的ReLU改进 | ECCV 2020
Using GaN based oversampling technique to improve the accuracy of model for mortality prediction of unbalanced covid-19
随机推荐
LeetCode 45 跳跃游戏II
云计算之路-出海记-小目标:Hello World from .NET 5.0 on AWS
微信小程序相关
中缀表达式转后缀表达式
Mobile big data own website precise marketing and accurate customer acquisition
寻找性能更优秀的动态 Getter 和 Setter 方案
Swagger介绍和应用
Constructors and prototypes
Newbe.ObjectVisitor 样例 1
What courses will AI programming learn?
Dynamic ReLU:微软推出提点神器,可能是最好的ReLU改进 | ECCV 2020
接口测试用例思路总结
在Python中创建文字云或标签云
[cloud service] there are so many ECS instances on alicloud server, how to select the type? Best practice note
Dynamic query processing method of stored procedure
Suffix expression to infix expression
Mongodb add delete modify query operation
采用注解+拦截器的方式进行异步执行的实现方式
综合架构的简述
C/C++学习日记:原码、反码和补码