Chinaunix首页 | 论坛 | 博客
  • 博客访问: 17770
  • 博文数量: 13
  • 博客积分: 530
  • 博客等级: 中士
  • 技术积分: 85
  • 用 户 组: 普通用户
  • 注册时间: 2009-11-26 21:58
文章分类

全部博文(13)

文章存档

2009年(13)

我的朋友
最近访客

分类: 数据库开发技术

2009-11-30 22:37:39

First Normal Form (1NF)
The first normalized form means the data is in an entity format, such that the following three
conditions are met:
? Every unit of data is represented within scalar attributes. A scalar value is a value “capable
of being represented by a point on a scale,” according to Merriam-Webster.
Every attribute must contain one unit of data, and each unit of data must fill one
attribute. Designs that embed multiple pieces of information within an attribute violate
the first normal form. Likewise, if multiple attributes must be combined in some way to
determine a single unit of data, the attribute design is incomplete.
? All data must be represented in unique attributes. Each attribute must have a unique
name and a unique purpose. An entity should have no repeating attributes. If the
attributes repeat, or the entity is very wide, the object is too broadly designed.
A design that repeats attributes, such as an order entity that includes item1, item2,
and item3 attributes to hold multiple line items, violates the first normal form.
? All data must be represented within unique tuples. If the entity design requires or permits
duplicate tuples, that design violates the first normal form.


The Second Normal Form (2NF)
The second normal form ensures that each attribute is in fact an attribute of the entity. It’s an
issue of dependency. Every attribute must require its primary key, or it doesn’t belong in the
database.
If the entity’s primary key is a single value, this isn’t too difficult. Composite primary keys can
sometimes get into trouble with the second normal form if the attributes aren’t dependent on
every attribute in the primary key. If the attribute depends on one of the primary key
attributes but not the other, that is a partial dependency that violates the second normal form.


The Third Normal Form (3NF)
The third normal form checks for transitive dependencies. A transitive dependency is similar
to a partial dependency in that they both refer to attributes that are not fully dependent on a
primary key. A dependency is transient when attribute1 is dependent on attribute2,
which is dependent on the primary key.

Just as with the second normal form, the normal form is resolved by moving the non-dependent
attribute to a new entity.


The Boyce-Codd Normal Form (BCNF)
The Boyce-Codd normal form occurs between the third and fourth normal forms, and it handles
a problem with an entity that might have two sets of primary keys. The Boyce-Codd normal
form simply stipulates that in such a case the entity should be split into two entities, one
for each primary key.


The Fourth Normal Form (4NF)

The fourth normal form deals with problems created by complex composite primary keys. If
two independent attributes are brought together to form a primary key along with a third
attribute, but the two attributes don’t really uniquely identify the entity without the third
attribute, then the design violates the fourth normal form.
The fourth normal form is used to help identify entities that should be split into separate entities.
Usually this is only an issue if large composite primary keys have brought too many disparate
objects into a single entity.


The Fifth Normal Form (5NF)
The fifth normal form provides the method for designing complex relationships that involve
multiple (three or more) entities. A three-way or ternary relationship, if properly designed, is
in the fifth normal form. The cardinality of any of the relationships could be one or many.
What makes it a ternary relationship is the number of related entities.

As an example of a ternary relationship, consider a manufacturing process that involves an
operator, a machine, and a bill of materials. From one point of view, this could be an operation
entity with three foreign keys. Or it could be thought of as a ternary relationship with
additional attributes.
Just like a two-entity many-to-many relationship, a ternary relationship requires a resolution
entity in the physical schema design to resolve the many-to-many into multiple artificial oneto-
many relationships. But, in this case the resolution entity has three or more foreign keys.


In such a complex relationship, the fifth normal form requires that each entity, if separated
from the ternary relationship, remains a proper entity without any loss of data.
阅读(548) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~