SQL 数据库中的函数依赖关系 范式
SQL 数据库中有两个函数依赖关系。
a) 部分功能依赖:非键列依赖于复合主键中的部分列,但不是全部列。
b) 传递函数依赖:任何非键列都依赖于其他非键列。
对于一个好的 SQL 数据库。
规则 1:列仅包含原子值
规则 2:没有重复的数据组
规则 3:没有部分依赖性
规则 4:没有传递依赖性
我已经理解了第 1 条和第 2 条规则的要求,为什么我们需要第三条和第四条规则,而不是说没有列不应该依赖于其他列。为什么有两个单独的规则(3 和 4)?
来源:Head First SQL
提前致谢!
There are two functional dependencies in the SQL databases.
a) Partial functional dependency: A non-key column is dependent on some, but not all of the columns in a composite primary key.
b) Transitive functional dependencies: Any non-key column depends on other non-key columns.
For a good SQL database.
Rule 1: Columns contain only atomic values
Rule 2: No repeating groups of data
Rule 3: Have no partial dependencies
Rule 4: having no transitive dependencies
I've understood the requirements of the 1 and 2nd rules, why do we need the 3rd and 4th rules, instead of saying the no column shouldn't depend on other columns. Why is there two separate rules (3 and 4)?
Source: Head First SQL
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好问题。纯粹出于历史和教学原因,这两者经常被分开。
第二范式 (2NF) 涉及仅消除部分键依赖性。单独的 2NF 通常并不是特别重要,因为第三范式、Boyce Codd 范式和更高范式也消除了那些相同的部分键依赖性,并且这些 NF(> 2NF)通常是数据库设计中的期望目标。然而,使用分解过程来教授标准化是常见的做法。通过分解方法,通常首先考虑部分键依赖关系。实际上,大多数实践者很少这样做,他们通常会同时考虑所有依赖关系。
高于 2NF 的范式定义根本不需要将部分键依赖作为特殊情况提及。 Boyce Codd 范式可以简单地概括为意味着每个非平凡的函数行列式都是一个超级键 - 换句话说,除了键之外的任何东西上都没有非平凡的 FD(任何类型)。
Good question. It is purely for historical and pedagogical reasons that these two are often separated.
Second Normal Form (2NF) is concerned with eliminating only partial key dependencies. 2NF alone normally isn't especially important because the Third Normal Form, Boyce Codd Normal Form and higher normal forms also eliminate those same partial key dependencies and those NFs (> 2NF) are usually the desired goal in database design. However, it is common practice to teach normalization using a process of decomposition. By the decomposition method, partial key dependencies are usually considered first. In reality this is rarely done by most practioners who will often consider all dependencies at once.
Definitions of Normal Forms higher than 2NF don't necessarily mention partial key dependencies as a special case at all. Boyce Codd Normal Form can be briefly summarised as meaning that every non-trivial functional determinant is a superkey - in other words, no non-trivial FDs (of any kind) on anything other than keys.