BCNF與4NF(第四次標準化)
數據庫規範化是一種處理關係數據庫管理系統的技術。在規範化良好的數據庫中,可以避免數據錯誤。規範化用於減少數據庫的數據冗餘。這意味著實現數據庫表及其關係,消除冗餘和不一致的依賴關係。為規範化設置了一些預定義的規則。這些規則被稱為規範形式。
- First Normal Form (1NF)
- Second Normal Form (2NF)
- Third Normal Form (3NF)
- Boyce-Codd Normal Form (BCNF or 3.5NF)
- Fourth Normal Form (4NF)
第一範式被稱為表的原子性。表原子性可以通過兩個步驟實現。
- Removing duplicate columns from the same table.
- Creating separate tables for related duplicated columns. ( there must be primary keys to identify each row of this tables)
在第二種標準形式中,嘗試通過提取表中的冗餘數據並將它們放在單獨的表中來減少這些數據。這可以通過執行以下步驟來實現。
- Select the data set, which applies to multiple rows, and place them in separate tables.
- Create the relati***hips between these new tables and parent tables using foreign keys.
要將數據庫轉換為第三範式,必須先實現第一範式和第二範式。當數據庫在1NF和2NF中時,沒有任何重複的列,也沒有任何適用於多行的數據子集。第三種標準形式可以通過刪除表的列來實現,這些列不是完全依賴於主鍵的。
Boyce-Codd標準型(BCNF或3.5NF)
BCNF代表“Boyce-Codd範式”。這種標準形式也稱為3.5數據庫規範化的標準形式。要實現BCNF,數據庫必須已經達到第三標準形式。然後通過以下步驟來實現BCNF。
- Identify all candidate keys in the relati***
- Identify all functional dependencies in the relati***.
- If there are functional dependencies in the relation, where their determinants are not candidate keys for the relation, remove the functional dependencies by placing them in a new relation along with a copy of their determinant.
第四範式
在將數據庫規範化為第四個標準格式之前,數據庫必須是第三個標準格式。如果數據庫已經是第三種正常形式,下一步應該是刪除多值依賴項。(如果一個或多個行暗示同一個表中存在一個或多個其他行,則稱為多值依賴項。)
BCNF和4NF(第四範式)有什麼區別?•數據庫必須已經達到3NF才能將其帶到BCNF,但數據庫必須在3NF和BCNF中,才能達到4NF。•在第四種範式中,表中沒有多值依賴關係,但在BCNF中,表中可以有多值依賴數據。 |