DBMS Table 的 Normalization


Normalization 是一個最小化 relations 的 redundency 的過程。有分數個 Normal Form 的等級,等級高的包含等級低的要求。

Attribute 類型

  • key attributes: 可形成 primary key 的 attributes
  • prime attribute: 是 key attribute,其本身可能是 key 或 key 的一部分。
  • nonprime attribute: 非 key attribute 的 attribute。

First Normal Form (1NF)

步驟: 1. 除去 Repeating Groups: 任何 attribute 是 single valued attribute,不能有多重值。 2. 辨認及選擇 Primary Key 3. 找出所有 dependencies

Dependencies 分為兩種:

Partial dependency

attribute 依賴於 primary key 部份的屬性。

Transitive dependency

attribute 依賴於非 primary key 的屬性。

Second Normal Form (2NF)

步驟: 1. 藉由產生新的 Tables 消除 Partial Dependencies: 產生新的表,含有被 Partial 依賴的屬性,且為新表的 Primary key。 2. 重指派對應的 Dependent Attributes: 在新的表增加依賴的屬性,從原表中刪除這些屬性。

Third Normal Form (3NF)

步驟: 1. 藉由產生新的 Tables 消除 Transitive Dependencies: 產生新的表,含有被 Transitive 依賴的屬性,且為新表的 Primary key。 2. 重指派對應的 Dependent Attributes: 在新的表增加依賴的屬性,從原表中刪除這些屬性。

dbms 

See also