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

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

这是对答案 Difference between 3NF and BCNF in simple terms (must be able to explain to an 8-year old) 的跟进。为什么下面的 table 在 3NF 中? 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

请详细说明。

您链接到的答案表明此 table 有两个键:(Pizza,Topping) 和 (Pizza,Topping Type)。依赖项 Topping->Topping Type 不违反 2NF 或 3NF,因为 Topping Type 是主要属性(候选键的一部分)。仅当 Topping Type 为非素数时,才会违反 2NF 和 3NF。

这个例子说明了BCNF和3NF的本质区别。 BCNF 关注所有属性的部分或非键依赖性,而不仅仅是非主要属性。