Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
170 views
in Technique[技术] by (71.8m points)

database - How to BCNF decompose when an attribute has no relation with any others

Assignment:

Consider a relation ??(??,??,??,??,??,??,??) and its FD set ?? = {???? → ????, ?? → ??, ?????? → ????, ?? → ????, ?? → ????, ?????? → ????}. Decompose it into a collection of BCNF relations if it is not in BCNF. Make sure your decomposition is lossless-join.

Explanation

Hi, I'm working on my database homework (relation design chapter). I think I've commanded the basic process based on in-class examples. However, the tricky part here is we have an attribute 'H' which has no relation with others, which confuses me deeply. How should I handle it?

Attempted answer

?   We start from a schema:?ABCDEGH, since H has no relations with any attribute, we decompose it into tables: H and ABCDEG
?   The FDs for ABCDEG remains the same, therefore key is E.
?   The FD?D →AG?violates BCNF (FD with non-key on LHS).
?   To fix, we need to decompose into tables:?ADG?and?BCDE
?   FDs for?ADG?are?{ D → AG }, therefore key is?D, therefore BCNF.
?   FDs for?BCDE?are?{ B → CD,? E → D,? BC → DE, E → B, CD → BE }
?   Key for?BCDE?is?also E, and FD?B → CD?violates BCNF (FD with non-key on LHS).
?   To fix, we need to decompose into tables:?BCD?and?BE
?   FDs for?BCD?are?{ B → CD }?therefore key is B, therefore BCNF.
?   FDs for?BE?are?{ E → B }?therefore key is E, therefore BCNF.
?   Final schema: ?H, ADG, BCD, BE

What are your comments about my mistakes?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Your first bullet is wrong. If you go to a reference like a published academic textbook that has a correct BCNF decomposition algorithm then it will not have that step.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...