gpt4 book ai didi

relational-database - 1NF 中的复合属性和多值属性会发生什么变化?

转载 作者:行者123 更新时间:2023-12-04 08:14:05 26 4
gpt4 key购买 nike

我有一个规范化问题,如下所示:

R={
att1(nb1, nb2, nb3),
att2, val1, val2, def1, class1,
class2{notion1, notion2},
def2,col1
}

在这里, attr1是一个多值属性和 class2是一个复合属性。

我如何转换 R到 1NF?

是不是像下面这样?
R={
nb1, nb2, nb3,
att2, val1, val2, def1, class1,
notion1, notion2,
def2,col1
}

最佳答案

是的,你的答案是正确的。正如 Wikipedia 中所说的:

A relation is in first normal form if the domain of each attribute contains only atomic values, and the value of each attribute contains only a single value from that domain.


换句话说,您不能拥有以下属性:
  • 结构化,即包含组件,或
  • 重复(或两者)。

  • 所以, att1class2必须由它们的组件代替。
    请注意,在结果关系中,对于与 nb1 不同的所有其他属性,您有不同的行具有相同的值。 , nb2nb3 .
    这种范式最初是在 E. Codd 于 1971 年的一篇论文中引入的:E. F. Codd,数据库关系模型的进一步规范化,Courant 研究所:Prentice-Hall,ISBN 013196741X,

    A relation is in first normal form if it has the property that none of its domains has elements which are themselves sets.


    (见 Wikipedia citation)。
    现在,这种范式仅出于历史原因出现在所有关系理论书籍中,因为此属性现在被认为是关系数据库模型的一部分。例如,参见 R. Elmasri、S. Navathe、Addison Wesley 所著的数据库系统基础一书(第 6 版第 519 页,ISBN:978-0-13-608620-8):

    First Normal Form

    First normal form (1NF) is now considered to be part of the formal definition of a relation in the basic (flat) relational model; historically, it was defined to disallow multivalued attributes, composite attributes, and their combinations. It states that the domain of an attribute must include only atomic (simple, indivisible) values and that the value of any attribute in a tuple must be a single value from the domain of that attribute. Hence, 1NF disallows having a set of values, a tuple of values, or a combination of both as an attribute value for a single tuple. In other words, 1NF disallows relations within relations or relations as attribute values within tuples. The only attribute values permitted by 1NF are single atomic (or indivisible) values.

    关于relational-database - 1NF 中的复合属性和多值属性会发生什么变化?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34541122/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com