简体   繁体   English

了解数据库规范化。 给定的表3NF如何?

[英]Understanding database normalization. How is the given table 3NF?

This a follow up on the answer Difference between 3NF and BCNF in simple terms (must be able to explain to an 8-year old) . 这是对3NF和BCNF区别的简单回答(必须能够向8岁的孩子解释) Why is the following table in 3NF? 为何在3NF中使用下表? Pizaa,Topping is the candidate key and Topping type is partially dependent on Topping, hence it is not even in 2NF. Pizaa,Topping是候选键,并且Topping类型部分取决于Topping,因此甚至在2NF中也是如此。

 Pizza    Topping    Topping Type
-------- ---------- -------------
1        mozarella  cheese
1        pepperoni  meat
1        olives     vegetable
2        mozarella  meat
2        sausage    cheese
2        peppers    vegetable

Please explain in detail. 请详细说明。

The answer you linked to states that there are two keys of this table: (Pizza,Topping) and (Pizza,Topping Type). 您链接到的答案表明此表有两个键:(比萨饼,浇头)和(比萨饼,浇头类型)。 The dependency Topping->Topping Type does not violate 2NF or 3NF because Topping Type is a prime attribute (part of a candidate key). 依赖项Topping-> Topping Type不会违反2NF或3NF,因为Topping Type是主要属性(候选密钥的一部分)。 2NF and 3NF would be violated only if Topping Type was non-prime. 仅当打顶类型为非质数时,才会违反2NF和3NF。

This example shows the essential difference between BCNF and 3NF. 此示例显示了BCNF和3NF之间的本质区别。 BCNF is concerned with partial or non-key dependencies for all attributes, not just non-prime attributes. BCNF关心所有属性的部分或非关键依赖性,而不仅仅是非主要属性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM