数据库规范化是一个逐步的正式过程,它使我们能够以最小化数据依存关系和更新异常的方式分解数据库表。它在分析表时利用了表中存在的功能依赖性以及主键或候选键。最初建议将范式称为第一范式(INF),第二范式(2NF)和第三范式(3NF)。
随后,R,Boyce和EF Codd引入了3NF的更强定义,称为Boyce-Codd Normal Form。除1NF以外,所有这些标准格式均基于表属性之间的功能依赖性。后来引入了超出BCNF的更高范式,例如第四范式(4NF)和第五范式(5NF)。但是,这些后来的普通形式处理的情况很少见。
归纳归纳总结:
Normal Form | Test | Remedy (Normalization) |
---|---|---|
1NF | Relation should have no non-atomic attributes or nested relations. | Form name relation for each non-atomic attribute or nested relation. |
2NF | For relations where primary key conatins multiple attributes, no non-key attributes should be functionally dependent on a part of the primary key. | Decompose and set up a new relation for each partial key with its dependent attributes. Make sure to keep a relation with the original primary key and any attributes that are fully functionally dependent on it. |
3NF | Relation should not have a non-key attribute functionally determined by another non-key attribute (or by a sets of non-key attributes) i.e., there should be no transitive dependency of a non-key attribute of the primary key. | Decompose and set up a relation that includes the non-key attribute(s) that functionally determine(s) other non-key attribute(s). |
BCNF | Relation should not have any attribute in Functional Dependency which is non-prime, the attribute that doesn’t occur in any candidate key. | Make sure that the left side of every functional dependency is a candidate key. |
4NF | The relation should not have a multi-value dependency means it occur when two attributes of a table are independent of each other but both depend on a third attribute. | Decompose the table into two subtables. |
5NF | The relation should not have join dependency means if a table can be recreated by joining multiple tables and each of the tables has a subset of the attributes of the table, then the table is in Join Dependency. |
Decompose all the tables into as many as possible numbers in order to avoid dependency. |