如果我们找到两个传递关系,我们将在规范化中做什么 [英] If we find two transitive relations what would we do in normalization

查看:71
本文介绍了如果我们找到两个传递关系,我们将在规范化中做什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我们有六列 A B C D E F,在删除传递依赖时,我们遇到了依赖,其中F->E,D,C,B,A(假设 F 是主键)

Say we have six columns A B C D E F, while removing transitive dependency we encounter the dependency where F-> E,D,C,B,A (say F is the primary key)

A->B(A 是 B 的传递键)

A->B (A is a transitive key towards B)

C->D(C 是 D 的传递键)

C->D (C is a transitive key towards D)

在这种情况下,我们会做什么,是创建一个有四列的新表,还是创建两个各有两列的表?

In this case what would we do, would we make a new table with four columns or will we make two tables with two columns each?

推荐答案

如果你有一个关系模式 R(A B C D) 和依赖:

If you have a relation schema R(A B C D) with dependencies:

A → B
C → D

那么以下事实成立:

  • 关系的关键是:

  • The key of the relation is:

A C

该关系既不属于 Boyce-Codd 范式,因为两个依赖关系(A → BC → D)都违反了行列式应该是超键,也不是第三范式(因为,除了前面的事实,BD 不是主要属性).

The relation is neither in Boyce-Codd Normal Form, since both dependencies (A → B and C → D) violates the rule that the determinant should be a superkey, nor in Third Normal Form (since, in addition the the previous fact, B and D are not prime attributes).

关系可以通过将其分解为三个关系来转换为第三范式(以及博伊斯-科德范式):

The relation can be transformed in Third Normal Form (and also Boyce-Codd Normal Form) by decomposing it in three relations:

  1. R1(A B),以A为键,唯一依赖:A → B
  2. R2(C D),以C为key,唯一依赖:C → D
  3. R3(A C),以A C为键,没有重要的依赖
  1. R1(A B), with A as key and unique dependency: A → B
  2. R2(C D), with C as key and unique dependency: C → D
  3. R3(A C), with A C as key and no non-trivial dependencies

已编辑

既然你改变了你的问题,答案就必须完全不同.您应该意识到,要解决规范化问题,应该有两件事(并且只有这两件事):

Since you have changed your question, the answer has to be completely different. You should be aware that to solve a normalization problem, one should have two things (and only those two things):

  1. 关系模式的属性列表

  1. The list of the attributes of the relation schema

一组函数依赖

不需要其他信息,而提供部分信息只会令人困惑,并不会产生正确的答案.

No other information is needed, while to give a partial information is only confusing and does not produces a correct answer.

所以,如果我理解你的问题,你需要规范化关系模式

So, if I have understood your problem, you need to normalize a relation schema

R(A B C D E F)

存在以下功能依赖项:

A → B
C → D
F → A B C D E

这种特殊情况下,

  • 关系的唯一(候选)键是F;

关系不在 BCNF 中,因为 A → BC → D 都违反了行列式应该是超键的规则,也不在 3NF (因为,除了前面的事实,BD 不是主要属性);

the relation is not in BCNF since both A → B and C → D violates the rule that the determinant should be a superkey, nor in 3NF (since, in addition the the previous fact, B and D are not prime attributes);

通过将其分解为三个关系,可以在 3NF(以及 BCNF)中转换该关系:

the relation can be transformed in 3NF (and also BCNF) by decomposing it in three relations:

  1. R1(A B),以A为键,唯一依赖:A → B
  2. R2(C D),以C为key,唯一依赖:C → D
  3. R3(ACEF),以F为key和依赖:F → A, F → C, F → E.
  1. R1(A B), with A as key and unique dependency: A → B
  2. R2(C D), with C as key and unique dependency: C → D
  3. R3(A C E F), with F as key and dependencies: F → A, F → C, F → E.

这篇关于如果我们找到两个传递关系,我们将在规范化中做什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆