当前位置:网站首页>The normal form of the database (first normal form, second normal form, third normal form, BCNF normal form) "recommended collection"
The normal form of the database (first normal form, second normal form, third normal form, BCNF normal form) "recommended collection"
2022-07-31 15:12:00 【Full stack programmer webmaster】
Hello everyone, meet again, I'm your friend Quanstack Jun.
Before we understand the paradigm, let's understand DatabaseThe concept of code in the library
1.Code
1.1 Oversize
It can uniquely identify an attribute or attribute group of a tuple. Any superset containing a supercode is also a supercode. Here, the unique identification tuple can be simply understood as querying the value of a certain field or several fields.A specific row of data
1.2 Candidate code
The smallest code selected from the supercode, that is, any proper subset of it cannot satisfy the condition.That is, attributes cannot be deleted.
1.3 Master Code
Select one of the candidate codes as the primary code.
2. Normal Form (NF)
Paradigm: A collection of relational schemas that conform to a certain level, in short, as far as the standard level of database table design is concerned, the paradigms are 1NF, 2NF, 3NF, BCNF, 4NF, etc., usually highHigh-level paradigms contain low-level paradigms.The design of the database is generally BCNF, and sometimes it is necessary for performance.
2.1 1 Normal Form (1NF)
1 Normal Form: The attributes of the tables in the relationship are not separable. For a simple example, there is a student table with the following fields, sid, sname, address, sid is the primary key, sname is the student's name, address is the address, and the address data may include provinces, cities, streets, etc.of.In the future, we may need to count the number of students in a city separately, and combine so much information into one attribute, that is, it does not conform to the first normal form, and the attribute should be divided into multiple fields such as province and city to meet business requirements.
2.2 2 Normal Form (2NF)
2 Normal Form: Eliminate partial functional dependencies of non-primary attributes on codes.Functional dependence: Simply put, if for each x attribute or attribute group there is a corresponding exact y value corresponding to it, the Y function is said to be dependent on x.Write x->y complete functional dependence: there is x->y, but there is no x'->y for any proper subset of x, which is called complete functional dependence.For example, there is a grade sheet with several fields, student ID, course, grade.(student number, course) -> grade, any (student number)!-> grades, (course)!-" grade, we call grade completely dependent on (student number, course) partial functional dependency: the Y function does not fully depend on x is called partial functional dependency, for example (student number, course) -> course name), the student ID has nothing to do with the course name, i.e. (course) -> course name.
2.3 3 Normal Form (3NF)
3 normal form: Eliminate the transfer function dependence of non-primary attribute pairs of codesTransfer function dependence: A relation R(U), X, Y, Z are subsets on the attribute set U, which existsX→Y and Y→Z, but Y does not determine X, that is, Y!->X and Y does not contain Z, then there is X→Z, that is, the X transfer function determines Z, and the Z transfer function depends on X.For example: commodity table: commodity name -> warehouse, warehouse!-> Commodities, warehouses -> warehouse administrators, warehouse administrators !-> warehouses (assuming a warehouse can have multiple administrators).
2.4 BCNF Normal Form (BCNF)
BCNF paradigm: Eliminate indirect functional dependencies and transfer functional dependencies between primary attributes.
3.Summary
Generally, our database design can be in 3 normal form or BCNF normal form, but in practical projects, there is always a trade-off between performance and scalability.The higher the database design standard, the better the scalability and the lower the coupling, but the performance also suffers.Therefore, sometimes it will come to 2 paradigms. In order to reduce the association between tables and speed up the query speed, various advantages and disadvantages need to be weighed by themselves.
Publisher: Full-stack programmer, please indicate the source: https://javaforall.cn/128339.htmlOriginal link: https://javaforall.cn
边栏推荐
- Architecture actual combat battalion module 8 message queue table structure design
- The role of /etc/profile, /etc/bashrc, ~/.bash_profile, ~/.bashrc files
- Word table to Excel
- Destruction order of thread_local variables
- NPM淘宝镜像(最新版本)于2021-11-21 16:53:52发布新版本npm镜像[通俗易懂]
- 高等数学——常用不定积分公式
- TCP详解
- vb中如何连接mysql_vb怎么连接数据库「建议收藏」
- 自动化测试如何创造业务价值?
- R语言ggplot2可视化:使用ggpubr包的ggboxplot函数可视化分组箱图、使用ggpar函数改变图形化参数(caption、添加、修改可视化图像的题注、脚注内容)
猜你喜欢

mongo进入报错

梅克尔工作室-第一次

Excel quickly aligns the middle name of the table (two-word name and three-word name alignment)

The paper manual becomes 3D animation in seconds, the latest research of Wu Jiajun of Stanford University, selected for ECCV 2022

为什么黑客领域几乎一片男生?

自适应控制——仿真实验三 用超稳定性理论设计模型参考自适应系统

Introductory UnityShader learning (2) - the rendering pipeline

TextBlock控件入门基础工具使用用法,取上法入门

模板与泛型编程值typelist实现

基于极限学习机(ELM)进行多变量用电量预测(Matlab代码实现)
随机推荐
NPM Taobao mirror (latest version) released a new version of npm mirror at 2021-11-21 16:53:52 [easy to understand]
使用 Chainlink Keepers 实现智能合约函数的自动化执行
华医网冲刺港股:5个月亏2976万 红杉与姚文彬是股东
R语言检验样本是否符合正态性(检验样本是否来自一个正态分布总体):shapiro.test函数检验样本是否符合正态分布(normality test)
STM32(十)------- SPI通信
Female service community product design
SIGABRT 报错时的注意事项和解决方法
自适应控制——仿真实验二 用Narendra方案设计模型参考自适应系统
网线RJ45接口针脚[通俗易懂]
学习笔记12--路径-速度分解法之局部路径搜索
radiobutton的使用
女性服务社群产品设计
How useful is four-quadrant time management?
使用 PyTorch 检测眼部疾病
WeChat chat record search in a red envelope
Prometheus之node_exporter性能监控信息采集含义
Nuget package and upload tutorial
名创优品斥资6.95亿购买创始人叶国富所持办公楼股权
为什么黑客领域几乎一片男生?
Network cable RJ45 interface pins [easy to understand]