个性化阅读
专注于IT技术分析

数据库管理系统|依存关系分解

依存关系保存

R的分解D = {R1, R2, R3….Rn}是依赖项, 如果函数F的集合F

(F1 ∪ F2 ∪ … ∪ Fm)+ = F+.
Consider a relation R
R ---> F{...with some functional dependency(FD)....}

R is decomposed or divided into R1 with FD { f1 } and R2 with { f2 }, then
there can be three cases:

f1 U f2 = F -----> Decomposition is dependency preserving. 
f1 U f2 is a subset of F -----> Not Dependency preserving.
f1 U f2 is a super set of F -----> This case is not possible.

问题:

让一个关系R(A, B, C, D)和功能依赖关系{AB –> C, C++–> D, D –> A}。关系R分解为R1(A, B, C)和R2(C, D)。检查分解是否保留依赖项。

解:

R1(A, B, C) and R2(C, D)

Let us find closure of F1 and F2
To find closure of F1, consider all combination of
ABC. i.e., find closure of A, B, C, AB, BC and AC
Note ABC is not considered as it is always ABC 

closure(A) = { A }  //Trivial
closure(B) = { B }  //Trivial
closure(C) = {C, A, D} but D can't be in closure as D is not present R1.
           = {C, A}
C--> A   //Removing C from right side as it is trivial attribute

closure(AB) = {A, B, C, D}
            = {A, B, C}
AB --> C  //Removing AB from right side as these are trivial attributes

closure(BC) = {B, C, D, A}
            = {A, B, C}
BC --> A  //Removing BC from right side as these are trivial attributes

closure(AC) = {A, C, D}
AC --> D  //Removing AC from right side as these are trivial attributes             


F1 {C--> A, AB --> C, BC --> A}.
Similarly F2 { C--> D }

In the original Relation Dependency { AB --> C , C --> D , D --> A}.
AB --> C is present in F1.
C --> D is present in F2.
D --> A is not preserved.

F1 U F2 is a subset of F. So given decomposition is not dependency preservingg.

问题1:

令R(A, B, C, D)为具有以下功能依赖性的关系架构:

A → B, B → C, C → D and D → B. 

The decomposition of R into 
(A, B), (B, C), (B, D)

(A)提供无损连接, 并且保持依赖关系

(B)提供无损连接, 但不保留依赖项

(C)不会提供无损连接, 而是保留依赖项

(D)不提供无损连接, 也不保留依赖项

参考这个解决方案。

问题2

R(A, B, C, D)是一个关系。下列哪一个没有不丢失连接, 保持BCNF分解的依存关系?

(A)A-> B, B-> CD

(B)A-> B, B-> C, C-> D

(C)AB-> C, C-> AD

(D)A-> BCD

参考这个解决方案。

如果发现任何不正确的地方, 或者想分享有关上述主题的更多信息, 请发表评论。

赞(0)
未经允许不得转载:srcmini » 数据库管理系统|依存关系分解

评论 抢沙发

评论前必须登录!