单属性主键和第二范式(2NF) [英] Single attribute primary key and second normal form (2NF)

查看:323
本文介绍了单属性主键和第二范式(2NF)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不确定此语句是对还是错:具有单个属性主键的表会自动至少采用第二范式(2NF)。

I am not sure if this statement is true or false: "A table with a single attribute primary key is automatically in at least second normal form (2NF)."

我认为这是对的,但我无法证明原因。

I think it is TRUE but I cannot justify why.

推荐答案

表要是第一个普通形式的属性一个表的值不能有多个值

For a table to be in first normal form,an attribute of a table cannot have multiple values

例如,

id   mobile_number   age
------------------------------
1    9xxx5xxxxx      25
     9xxx6xxxxx      
2    8xxxx5xxxx      26 
     7xxxx5xxxx      

可以将其标准化为1NF,如下所示:

This can be normalized to 1NF as follows,

id  mobile_number  age
------------------------------------
1   9xxx5xxxxx     25
1   9xxx6xxxxx     25
2   8xxxx5xxxx     26 
2   7xxxx5xxxx     26 

如果表是第一种普通形式且没有非素数a,则该表被称为第二种普通形式属性取决于任何候选密钥的适当子集

A table is said to be in second normal form if the table is in the first normal form and no non-prime attributes depend on a proper subset of any candidate key

此处候选密钥为{id,mobile_number}

Here candidate key is {id,mobile_number}

Non主属性是年龄

该表不在2NF中,因为非主属性(age)仅取决于候选键(id)的适当子集。

The table is not in 2NF because the non-prime attribute(age) is dependent on proper subset of candidate key(id) alone.

要将其标准化为2NF,我们按如下所示拆分表

To normalize this to 2NF,we split the table as follows

id   mobile_number
------------------------------
1    9xxx5xxxxx
1    9xxx6xxxxx
2    8xxxx5xxxx
2    7xxxx5xxxx

id age
------
1  25
2  26  

这篇关于单属性主键和第二范式(2NF)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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