Database: Normal form

系统 1894 0

refer to wikipedia---

1NF(first normal form):

1. There's no top-to-bottom ordering to the rows.

2. There's no left-to-right ordering to the columns.

3.  There are no duplicate rows.

4.  Every row-and-column intersection contains exactly one value from the applicable domain (and nothing else).

5.  All columns are regular [i.e. rows have no hidden components such as row IDs, object IDs, or hidden timestamps].

 

2NF(second normal form):

if and only if it is in 1NF and every non-prime attribute of the table is dependent on the whole of a candidate key.

A non-prime attribute of a table is an attribute that is not a part of any candidate key of the table.

Not all 2NF tables are free from update anomalies.

A table for which there are no partial functional dependencies on the primary key is typically, but not always, in 2NF.

 

 

3NF(third normal form):

The relation R (table) is in 2NF

Every non-prime attribute of R is non-transitively dependent (i.e. directly dependent) on every  s uperkey of R.

transitive dependency  is a  functional dependency  in which  X  →  Z  ( X  determines  Z ) indirectly, by virtue of  X  →  Y  and  Y  →  Z  (where it is not the case that  Y  →  X ).

Requiring existence of "the key" ensures that the table is in  1NF ; requiring that non-key attributes be dependent on "the whole key" ensures  2NF ; further requiring that non-key attributes be dependent on "nothing but the key" ensures 3NF.

 

BCNF(3.5 normal form):

If a  relational schema  is in BCNF then all redundancy based on functional dependency has been removed, although other types of redundancy may still exist. A relational schema  R  is in Boyce–Codd normal form  if and only if  for every one of its  dependencies   X → Y , at least one of the following conditions hold: [4]

  • X → Y  is a trivial functional dependency (Y ⊆ X)
  • X  is a  superkey  for schema  R

A 3NF table which does not have multiple overlapping candidate keys is guaranteed to be in BCNF. Depending on what its functional dependencies are, a 3NF table with two or more overlapping candidate keys may or may not be in BCNF

 

3NF:只消除非主属性对主属性的传递依赖;

BCNF:消除所有属性对主属性的传递依赖。

 

4NF(forth normal form):

Table  is in 4NF  if and only if , for every one of its non-trivial multivalued dependencies  X     Y X  is a  superkey —that is,  X  is either a  candidate key  or a superset thereof.

trivial multivalued dependency   X     Y  is one where either  Y  is a subset of  X , or  X  and  Y  together form the whole set of attributes of the relation.

Database: Normal form


更多文章、技术交流、商务合作、联系博主

微信扫码或搜索:z360901061

微信扫一扫加我为好友

QQ号联系: 360901061

您的支持是博主写作最大的动力,如果您喜欢我的文章,感觉我的文章对您有帮助,请用微信扫描下面二维码支持博主2元、5元、10元、20元等您想捐的金额吧,狠狠点击下面给点支持吧,站长非常感激您!手机微信长按不能支付解决办法:请将微信支付二维码保存到相册,切换到微信,然后点击微信右上角扫一扫功能,选择支付二维码完成支付。

【本文对您有帮助就好】

您的支持是博主写作最大的动力,如果您喜欢我的文章,感觉我的文章对您有帮助,请用微信扫描上面二维码支持博主2元、5元、10元、自定义金额等您想捐的金额吧,站长会非常 感谢您的哦!!!

发表我的评论
最新评论 总共0条评论