第二范式:人工键与复合主键

Second normal form : Artificial key vs Composite Primary Key

我最近读到第二范式:"If your table has an artificial primary key and no composite primary key, it's in second normal form"。 如果我的 table 在我的 table 中有一个人工键和一个复合主键怎么办? 那么也是第二范式吗?

每个 候选键由单个列组成的关系属于 2NF。 (关系模型总是考虑 每个 候选键。)

element_name  atomic_number  chem_symbol
--
Hydrogen      1              H
Helium        2              He
Lithium       3              Li
...

这里的每个属性都是一个候选键。这个 table 在 2NF 中。它也在 3NF、BCNF、4NF 和 5NF 中。

What if my table has an artificial key as well as a composite primary key in my table? Will it be in second normal form, then also?

这取决于非素数属性和它们的依赖性。如果您有一个在功能上依赖于该复合主键的一部分的非主属性,则该关系不在 2NF 中。