📜  DBMS 中的规范化过程

📅  最后修改于: 2021-09-27 15:15:49             🧑  作者: Mango

数据库规范化是一个逐步的正式过程,它允许我们以最小化数据依赖性和更新异常的方式分解数据库表。它利用表中存在的函数依赖和主键或候选键来分析表。最初提出的范式称为第一范式 (INF)、第二范式 (2NF) 和第三范式 (3NF)。

随后,R、Boyce 和 EF Codd 引入了一个更强的 3NF 定义,称为 Boyce-Codd 范式。除了 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.