当前位置:网站首页>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
边栏推荐
- 蔚来杯2022牛客暑期多校训练营4
- Groupid(artifact id)
- Essential Learning for Getting Started with Unity Shader - Transparency Effect
- 微信聊天记录中搜索红包
- Nuget package and upload tutorial
- hough变换检测直线原理(opencv霍夫直线检测)
- TextBlock控件入门基础工具使用用法,取上法入门
- STM32(十)------- SPI通信
- 分成两栏后文字顺序混乱的问题解决【写期刊论文时】
- Message queue data storage MySQL table design
猜你喜欢

【MySQL】Mysql范式及外键作用

如何进行需求分析评审

NC | 斯坦福申小涛等开发数据可重复分析计算框架TidyMass

AVH Deployment Practice (1) | Deploying the Flying Paddle Model on Arm Virtual Hardware

最小费用最大流问题详解

button控件的使用

Kubernetes原理剖析与实战应用手册,太全了

梅克尔工作室-第一次

11 pinia使用
![Recommendation System - Recall Phase - 2013: DSSM (Twin Towers Model) [Embedding (Semantic Vector) Recall] [Microsoft]](/img/40/b567780ed2cf04f1f1336922816f86.png)
Recommendation System - Recall Phase - 2013: DSSM (Twin Towers Model) [Embedding (Semantic Vector) Recall] [Microsoft]
随机推荐
2021 OWASP TOP 10 漏洞指南
R language test whether the sample conforms to normality (test whether the sample comes from a normally distributed population): shapiro.test function tests whether the sample conforms to the normal d
工程水文学复习资料
梅克尔工作室-第一次
基于最小二乘法和SVM从天气预报中预测太阳能发电量(Matlab代码实现)
Small test knife: Go reflection helped me convert Excel to Struct
Trigonometric identity transformation formula
双边滤波加速「建议收藏」
使用 GraphiQL 可视化 GraphQL 架构
高等数学——常用不定积分公式
Excel quickly aligns the middle name of the table (two-word name and three-word name alignment)
四象限时间管理有多好用?
leetcode303 Weekly Match Replay
Prometheus之node_exporter性能监控信息采集含义
element-plus虚拟表格virtual-list组件中是怎么实现清理lodash.memoize缓存的?
thread_local 变量的析构顺序
工程力学复习资料
Word table to Excel
Public Key Retrieval is not allowed error solution when DBeaver connects to MySQL 8.x
DBeaver连接MySQL 8.x时Public Key Retrieval is not allowed 错误解决