【问题标题】:What is the highest normal form of {a,b,c,d,e} a,b->c, a,b->d and d->e?{a,b,c,d,e} a,b->c, a,b->d 和 d->e 的最​​高范式是什么?
【发布时间】:2012-01-27 15:15:21
【问题描述】:

用于设计示例数据库。

是 3NF 还是 BCNF?

【问题讨论】:

  • 再详细一点就好了。

标签: normalization rdbms database


【解决方案1】:

基于这些依赖关系,唯一的键是 {a,b}。因此 {a,b,c,d,e} 具有传递依赖关系:ab->d 和 d->e。由于它具有传递依赖,{a,b,c,d,e} 不在 3NF 中。

可能在 2NF 中,但如果不知道列的含义或知道代表值,我无法确定。例如,如果 c 列包含不同数量的电话号码,它甚至可能不在 1NF 中。 (在计算机科学作业中,您通常可以假设每列包含一个值。在 SO 上,您通常不能。)

当您规范化关系时,您会根据依赖关系投影属性子集。 (基于您的情况中的 functional 依赖项。)因此您可以用这两个替换原始关系。

  • {a,b,c,d}
  • {d,e}

其中第一个可能至少在 4NF 中。第二个可能在 6NF 中。 (但请参阅上面的第 2 段。)

规范化并不是说你可以从 2NF 移动到 3NF 并且没有更高,从 3NF 移动到 BCNF 并且没有更高,从 BCNF 移动到 4NF 并且没有更高,以此类推。但这是对规范化如何工作的常见误解。在您的情况下,分解原始关系会产生 4NF 中的一个关系(至少)和 6NF 中的一个关系。根据定义,这两者也是在 3NF 中,但是没有一种正常(咳嗽)的方式来分解你的 2NF 关系以得到 3NF 中的关系并且没有更高的

【讨论】:

  • 很好,但是从 3NF 和 BCNF 中选择什么?
  • 如果不移除传递依赖,它就不能在 3NF 或 BCNF 中。如果删除传递依赖关系,则两个表都可能超出 BCNF。所以你不会选择 3NF 或 BCNF。
【解决方案2】:

范式的目标是正式指定和保证模式的某种质量。例如。仅满足第二范式条件的模式包含不一起属于模式的属性/功能依赖关系,从而导致冗余和异常。 原始模式:({A, B, C, D, E, F}, {A → B C, C → A D, E → A B C, F → C D, C D → B E F, A B → D}) 主要属性:{A,C,E,F},候选键:{A},{C},{E},{F} 非主要属性:{B, D}

  1. 范式:必须为其他范式假定。

  2. 范式:每个非主属性都必须在功能上完全依赖于每个候选键。

模式肯定是第二范式!

  1. 范式:对于每个函数依赖 α → β,α 必须是超键,或者 β 侧的每个属性都必须是平凡的或素键属性。

    从 A → B C 的 α 边 {A} 是模式的超键(即键至少包含候选键的属性)。

    来自 C → A D 的 α 边 {C} 是模式的超键(即键至少包含候选键的属性)。

    来自 E → A B C 的 α 边 {E} 是模式的超键(即键至少包含候选键的属性)。

    从 F → C D 的 α 边 {F} 是模式的超键(即键至少包含候选键的属性)。

    来自 C D → B E F 的 α 边 {C, D} 是模式的超键(即键至少包含候选键的属性)。

    A B → D 的 α 边 {A, B} 是模式的超键(即键至少包含候选键的属性)。

模式至少是第三范式!

Boyce-Codd-Normalform :对于每个函数依赖 α → β,α 端必须是超键还是函数依赖必须是微不足道的。

The α-side {A} from A → B C is a superkey of the schema (i.e. the key contains at least the attributes of a candidate-key).

The α-side {C} from C → A D is a superkey of the schema (i.e. the key contains at least the attributes of a candidate-key).

The α-side {E} from E → A B C is a superkey of the schema (i.e. the key contains at least the attributes of a candidate-key).

The α-side {F} from F → C D is a superkey of the schema (i.e. the key contains at least the attributes of a candidate-key).

The α-side {C, D} from C D → B E F is a superkey of the schema (i.e. the key contains at least the attributes of a candidate-key).

The α-side {A, B} from A B → D is a superkey of the schema (i.e. the key contains at least the attributes of a candidate-key).

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-07-28
    • 1970-01-01
    • 2013-06-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多