当前位置:网站首页>[Principle of Database System] Chapter 3 BC Normal Form, Third Normal Form and Fourth Normal Form
[Principle of Database System] Chapter 3 BC Normal Form, Third Normal Form and Fourth Normal Form
2022-08-07 14:42:00 【JKL27】
文章目录
第三章 关系数据库设计理论
3.5 BCnormal form and third normal form
BC范式(BCNF)
定义:
关系 R 满足 BCNF
当且仅当:如果 R 中非平凡FD A1,A2,…,An→B 成立,则 {A1,A2,…,An} 是关系 R 的超键.
对定义的理解:
每个非平凡FDThe left side must be a superkey.
(Since superkeys don't necessarily have to be minimized,So it can be described equivalently as ,每个非平凡FDmust contain keys to the left.)
结论
Any binary relation belongs toBCNF.
In the case of multiple keys, as long as any key is included, it is satisfied BCNF 的条件.
分解到 BCNF:Left and right circle method
寻找违反BCNFnon-trivialFD A→B ,找到 { A } + \{ A \}^+ { A}+,放到该FD的右端.
The relational schema is then decomposed directly into two parts:
- 一部分为该FD的左端Aand the right-hand property set
- 一部分为该FD的左端A和该FDAll properties not included
如图:

例题:
P51 例3.19 $ {title, year, studioName, president, presAddr} $,
其中,有FD:
t i t l e , y e a r → s t u d i o n a m e title, year → studioname title,year→studioname
s t u d i o n a m e → p r e s i d e n t studioname → president studioname→president
p r e s i d e n t → p r e s A d d r president → presAddr president→presAddr
解:
以 Follow the violationBCNF的 s t u d i o n a m e → p r e s i d e n t studioname \to president studioname→president 来分解 为例:
计算闭包,The unique key is derived { t i t l e , y e a r } \{ title, year \} { title,year}.
则 R 1 = { t i t l e , y e a r ‾ , s t u d i o n a m e } {R_1 = \{\underline{title,year},studioname\}} R1={ title,year,studioname}
R 2 = { s t u d i o n a m e ‾ , p r e s i d e n t , p r e s A d d r } {R_2 = \{\underline{studioname}, president,presAddr\}} R2={ studioname,president,presAddr}
R2 不符合BC范式,So break it down again(Follow the violationBCNFbasic set p r e s i d e n t → p r e s A d d r president \to presAddr president→presAddr).
得到 R 3 = { p r e s i d e n t , p r e s A d d r } {R_3 = \{president, presAddr\}} R3={ president,presAddr}
R 4 = { p r e s i d e n t , s t u d i o n a m e } {R_4 = \{president, studioname\}} R4={ president,studioname}
最终结果即为 R1, R3, R4.
第三范式(3NF)
定义
如果 R 中非平凡FD A 1 , A 2 , . . , A n → B 1 , B 2 , . . , B m A_1,A_2,..,A_n→ B_1,B_2,..,B_m A1,A2,..,An→B1,B2,..,Bm 成立,
那么或者 {A1,A2,…,An} 是关系R的超键,或者 each belongs B 但不属于 A 的属性都是某个键的成员.
“主属性” 表示 The properties the key contains.
对定义的理解
i.e. for any non-trivialFD,①The properties on the left are R 的超键 或者 ②The properties on the right are the properties of the key.
3.6 多值依赖
定义
在关系 R 中,When given the value of a property collection,There is a set of AND relationshipsAll other property valuesindependent property values.(以 R ( A , B , C ) R(A,B,C) R(A,B,C) 为例)
独立:cannot be mutually determined,The mutual values include all combinations.
若给定 R 中属于 A the value of each attribute,
There is an attribute set B,B The value is independent of R neither belong toA也不属于B的属性集合(也就是C)的值,
则 R 中 MVD A 1 , A 2 , . . , A n → → B 1 , B 2 , . . , B m \text{MVD} A_1,A_2,..,A_n→→ B_1,B_2,..,B_m MVDA1,A2,..,An→→B1,B2,..,Bm 成立,称 A 1 , A 2 , . . , A n A_1,A_2,..,A_n A1,A2,..,An 多值决定 B 1 , B 2 , . . , B m B_1,B_2,..,B_m B1,B2,..,Bm .对于 R 中每个在 A A pair of tuples with the same value above t 和 u,A tuple that satisfies the following conditions can be found v:
在 A 属性上的取值与 t 和 u 相同;
在 B 属性上的取值与 t 相同;
在 AB and on all other properties except u 相同.如图:

对定义的理解
- 设 U 是关系模式R的属性集合,X,Y,Z是 U 的子集,并且 Z = U - X - Y.
R中存在多值依赖 X→→Y ,
当且仅当 对于 R any relationship in r ,给定一对(x,z)值,有一组 Y 值,这组 Y The value depends only on x 值而与 z 值无关.
在 R(U) 的任一关系 r 中,如果存在元组 t,s 使得 t[X] = s[X],那么就必然存在元组 w,v ∈ r,(w,v可以与s,t相同),使得 w[X] = v[X] = t[X],而 w[Y] = t[Y],w[Z] = s[Z],v[Y] = s[Y],v[Z] = t[Z](即交换s,t元组的Y值所得的两个新元组必在 r 中),则 Y 多值依赖于 X,记为 X→→Y. 这里,X,Y是U的子集,Z = U - X - Y.
如图:

- 设 U 是关系模式R的属性集合,X,Y,Z是 U 的子集,并且 Z = U - X - Y.
平凡多值依赖
- X→→Y,若 Y 包含于 X 或者Z=U - X - Y = Ø,则称 X→→Y 为平凡的多值依赖;
- Trivial multivalued dependencies must hold,之所以称为“平凡的”because it cannot be definedRon any significant or meaningful constraints.
Inference of multivalued dependencies
函数依赖(FD)is a multi-valued dependency(MVD)的特殊情况.
这意味着,如果 A 1 A 2 . . . A n → B 1 B 2 . . . B m A_1A_2...A_n \rightarrow B_1B_2...B_m A1A2...An→B1B2...Bm,则 A 1 A 2 . . . A n → → B 1 B 2 . . . B m A_1A_2...A_n \rightarrow \rightarrow B_1B_2...B_m A1A2...An→→B1B2...Bm 也成立.
证明见 PPT
Features of multivalued dependencies
MVD Does not follow the decomposition principle.
例如,有 name →→ street city,但是 name →→ street 并不成立.(P63 例3.30)
互补规则(对称性)
互换BCsymbols are available, 即 Z = U - X - Y,R 中存在多值依赖 X →→Y,则 R There are also multivalued dependencies in X →→Z.
第四范式(4NF)
定义:
在 R 中,若任一 非平凡MVD 成立时,都有 On the left is the super key 的结论,则 R 属于第四范式.
第四范式是 BCNF 的特例,满足 4NF 则满足 BCNF,违反 BCNF 则违反 4NF.
(4NF 包含于 BCNF)
证明见 PPT
Decomposition to fourth normal form
If a multivalued dependency is left is not a superkey,则违反了4NF条件,Use the projection decomposition method to decompose the corresponding relationship R Decomposed into two relations:
含有 A 和 B 的全部属性
含有 A of all attributes and absences AB 中的全部属性
(与BCNFThe left and right circle decomposition methods in are very similar)
connections between paradigms
- 3NF:Any non-trivial function depends onThe left side is a super key or the right side is a primary property;
- BCNF:Any non-trivial function depends onOn the left are the super keys;
- 4NF:任何The left side of a nontrivial multivalued dependency is a superkey;

边栏推荐
- up to date!A summary of all Kaggle competition open source solutions and Top ideas, a total of 477 competitions!
- A character occurrences HJ2 calculation
- Introduction to common methods and principles of Lombok
- Expert C Programming Chapter 8 Why Programmers Can't Tell the Difference Between Halloween and Christmas 8.2 Building Graphics from Bit Patterns
- 处理乱码的问题oracle字符集WE8MSWIN1252和WE8ISO8859P1
- dotnet 线程静态字段
- 想交易场内基金去哪个证券公司开户更快更安全
- RPG游戏地图场景管理维护(服务器)
- 【YOLOv7_0.1】网络结构与源码解析
- 002_认识微服务
猜你喜欢

国内软件测试岗,可以卷到什么程度?

基于RK3566中RTL8201F网口百兆调试笔记

自定义视频播放器

手工测试转自动化,学习路线必不可少,更有【117页】测开面试题,欢迎来预测

哈希表 | 三数之和、四数之和 | 用`双指针法`最合适 | leecode刷题笔记

Codeforces Round #812 (Div. 2)

浏览器工作原理与实践学习笔记(一)宏观视角下的浏览器

Hash table | The sum of three numbers, the sum of four numbers | The most suitable `double pointer method` | leecode brush notes

【数据库系统原理】第四章 高级数据库模型:弱实体集、E/R 联系到关系的转化、子类结构到关系的转化

【HCIP】BGP 选路问题小型实验
随机推荐
LeetCode 热题 HOT 100(4.寻找两个正序数组的中位数)
The sword refers to Offer | Adjust the order of the array so that the odd numbers come before the even numbers
HJ8 merge table records
Chapter 8 C programming expert why programmers cannot distinguish where Halloween and Christmas 8.5 prototype fail
06 【泛型】
AQS同步组件-Semaphore(信号量)解析和案例
LeetCode HOT HOT 100 (5. Back to the longest text string)
使用同花顺软件炒股安全吗?
C专家编程 第8章 为什么程序员无法分清万圣节和圣诞节 8.9 如何进行强制类型转换,为何要进行类型强制转换
Is it safe to use a straight flush in stocks?Will the funds be transferred?
我住得比较远,有好的开户途径么?手机开户股票开户安全吗?
多线程-线程的状态、优先级、守护进程
关于云和恩墨对“HTAP”和“智能仓湖”等关系的研究
The ADC external RC circuit resistance and capacitance selection calculation method
Programming Experts in C Chapter 8 Why Programmers Can't Tell the Difference Between Halloween and Christmas 8.8 Software is more difficult than hardware
Visual Studio 自定义项目模板
dotnet 将文件删除到回收站
HJ5 base conversion
response status code
手工测试转自动化,学习路线必不可少,更有【117页】测开面试题,欢迎来预测