database 分解为第三范式 (3NF)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4361910/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Decomposition into Third Normal Form (3NF)
提问by Chris
Scheme (R) = (A,B,C,D,E,F,G,H)
Function Dependencies (F) = {A->CGH, AD->C, DE->F, G->H}
How would I perform a lossless-join decomposition of the schema R into Third Normal Form (3NF)?
我将如何将模式 R 无损连接分解为第三范式 (3NF)?
Any help will be appreciated.
任何帮助将不胜感激。
回答by Jonathan Leffler
Since A→CGH and Ax→C for any letter x, we can ignore the second of the functional dependencies (AD→C) because it doesn't tell us anything that A→CGH doesn't also tell us.
由于 A→CGH 和 Ax→C 对于任何字母 x,我们可以忽略第二个函数依赖关系(AD→C),因为它没有告诉我们 A→CGH 也没有告诉我们的任何事情。
There is nothing that determines B; there is nothing that determines D.
没有什么可以决定B;没有什么可以决定 D。
Since G determines H, and A determines both G and H, we can separate G→H into a relation (there is a transitive dependency A→G and G→H).
由于 G 决定了 H,而 A 决定了 G 和 H,我们可以将 G→H 分离成一个关系(存在传递依赖 A→G 和 G→H)。
R1 = { G, H } : PK = { G }
That leaves F' = { A→CG, DE→F } and R' = (A, B, C, D, E, F, G).
剩下 F' = { A→CG, DE→F } 和 R' = (A, B, C, D, E, F, G)。
The two functional dependencies left can form two more relations:
剩下的两个函数依赖可以形成另外两个关系:
R2 = { A, C, G } : PK = { A }
R3 = { D, E, F } : PK = { D, E }
That leaves R'' = { A, B, D, E }
剩下 R'' = { A, B, D, E }
R4 = { A, B, D, E } : PK = { A, B, D, E }
The join of R1, R2, R3, and R4 should leave you with the R you started with for any starting value of R (that satisfies the constraints of the given functional dependencies).
R1、R2、R3 和 R4 的连接应该为您保留 R 的任何起始值(满足给定函数依赖项的约束)。
回答by overloading
Overall you should get the min cover first and then add the key ABDE
总体而言,您应该先获得最小覆盖,然后添加密钥 ABDE