美文网首页
FDs & Normalization 数据库习题

FDs & Normalization 数据库习题

作者: 青蛙水手 | 来源:发表于2020-05-08 13:57 被阅读0次

第1题:

[4 points] Consider the attribute set R = ABCDEF and the functional dependency set

F = {AD → B, A → E, C → E, DEF → A, F → D}. Find a candidate key of R.

FC

Notice that FC is not on the right-hand side of any of the given FDs. This means that any key of R must contain FC. Find the closure of FC to see that FC -> R. Thus, FC is a candidate key. Any other

key would be superkey, since a key must contain FC.

第2题:

[6 points] Given the attribute set R = ABCDEFGH and the functional dependency set

F = {BC → GH, AD → E, A → H, E → BCF, G → H}, decompose R into BCNF by decomposing in the

order of the given functional dependencies.

ADE, BCEF, GH, BCG

BC -> GH violates BCNF, decompose.

Relations: ABCDEF BCGH

AD -> E does not violate BCNF because AD is a superkey, skip.

A -> H No relation contains AH, skip.

E -> BCF violates BCNF, decompose.

Relations: ADE EBCF BCGH

G -> H violates BCNF, decompose.

ADE EBCF BCG GH

第3题:

[6 points] Given the attribute set R = ABCDEF and the functional dependency set

F = {B → D, E → F, D → E, D → B, F → BD}.

a) Is the decomposition ABDE, BCDF lossless?

b) If not, what functional dependency could you add to make it lossless?

a. No, it is lossy

ABDE ∩ BCDF = BD

BD -> BDEF, which is not equivalent to either ABDE or BCDF

b. Any or all of BDEF -> Any or all of AC

For example some valid answers were: B -> C, B -> A, BEFD -> AC, etc.

To be lossless, we want BD -> ABDE or BD -> BCDF. We know that BD ->

BDEF, so either want BD -> ABDEF or BD -> CBDEF (or both!).

This will be satisfied if BDEF -> A and/or C.

相关文章

网友评论

      本文标题:FDs & Normalization 数据库习题

      本文链接:https://www.haomeiwen.com/subject/pjdfnhtx.html