数据库范式5nf_第四范式(4NF)| 数据库管理系统
數據庫范式5nf
Fourth normal form (4NF) is a normal form used in database normalization, in which there are no non-trivial multivalued dependencies except a candidate key. After Boyce–Codd normal form (BCNF), 4NF is the next level of normalization. Although the second, third, and Boyce–Codd normal forms operate with functional dependencies, 4NF is operated with a more universal type of dependency known as a multivalued dependency.
第四范式(4NF)是數據庫規范化中使用的范式 ,其中沒有除候選鍵之外的非平凡多值依賴項。 在Boyce-Codd范式(BCNF)之后,4NF是下一級別的規范化。 盡管第二,第三和Boyce-Codd范式具有功能依賴性,但4NF卻具有更為通用的依賴性類型,即多值依賴性。
A table or relation is in 4NF if and only if, for each attribute of its non-trivial multivalued dependencies P→Q, P is a super key—that means, P is either a candidate key or a superset thence.
當且僅當表或關系對于其非平凡多值依賴項P→Q的每個屬性,P是一個超級鍵,也就是說,P是一個候選鍵或一個父集,才在4NF中。
Properties:
特性:
A relation R with attributes, its values and tuples is in 4NF if and only if the following conditions are satisfied.
當且僅當滿足以下條件時,帶有屬性,其值和元組的關系R才為4NF。
The relation or table should be in the Boyce-Codd Normal Form (BCNF).
關系或表格應采用Boyce-Codd范式(BCNF)。
The relation or table should not have any Multivalued Dependency.
關系或表不應具有任何多值依賴關系。
A table which consists of a multivalued dependency breaches the normalization attainment of Fourth Normal Form (4NF) because it generates unneeded redundancies and can contribute to incompatible data which will not be inconsistency. To take this forward and up towards 4NF, it is important to divide this data and information into two tables or relations.
由多值依賴關系組成的表違反了第四范式(4NF)的歸一化程度,因為它產生了不必要的冗余,并且可能導致不兼容的數據,并且不會造成不一致。 為了朝著4NF邁進,將這些數據和信息分成兩個表或關系很重要。
Multivalued Dependency
多值依賴
Multivalued dependency takes place when there are one or more rows in a table or relation which indicates the existence of one or more other rows in the same table or relation. In another way, if we observe, two attributes (or columns) in a table or relation are not dependent on each other, but both of them depend on a third attribute. A multivalued dependency always needs a minimum of three attributes because it contains at least two attributes that are dependent on a third.
當表或關系中存在一個或多個行時,即表示同一表或關系中存在一個或多個其他行,則發生多值依賴。 用另一種方式,如果我們觀察到,表或關系中的兩個屬性(或列)彼此不依賴,但是它們兩者都依賴于第三個屬性。 多值依賴項始終至少需要三個屬性,因為它包含至少兩個依賴于第三個屬性。
For a Functional dependency in which P holds Q (P -> Q), if for a single value of P, multiple values of Q exists, then the table or relation may have a multi-valued dependency. The table or relation should contain minimally three attributes and Q and S should not be dependent for P ->> Q multivalued dependency.
對于其中P保持Q(P-> Q)的功能依賴關系,如果對于P的單個值,存在Q的多個值,則表或關系可能具有多值依賴關系。 該表或關系應至少包含三個屬性,并且Q和S不應依賴于P->> Q多值依賴關系。
If the following points are satisfied, then a table or relation has a multivalued dependency,
如果滿足以下幾點,則表或關系具有多值依賴關系,
In a table, for a Functional Dependency P which holds Q (P → Q), if for a single value of P, multiple value of Q exists, then the table may have multi-valued dependency.
在一個表中,對于具有Q(P→Q)的功能依賴性P,如果對于P的單個值,存在Q的多個值,則該表可能具有多值依賴性。
Also, the condition is that a table should have at-least three columns for it to have a multivalued dependency.
同樣,條件是一個表應至少具有三列,以使其具有多值依賴關系。
And, for a relation R(P, Q, S), if there is a multi-valued dependency between P and Q, then Q and S should not be dependent on each other.
并且,對于關系R(P,Q,S),如果在P和Q之間存在多值依賴關系,則Q和S不應相互依賴。
Example:
例:
Consider a database table which contain student Name, Hobby and subject,
考慮一個包含學生姓名,愛好和科目的數據庫表,
table.ok, table.ok tr th, table.ok tr td {border: 1px solid black;width: auto; } table.ok, table.ok tr th, table.ok tr td {border: 1px solid black;width: auto; }| Arvind | Cricket | Maths |
| Sameer | Football | Science |
| Rajeev | Chess | Social science |
| Simran | Badminton | English |
| Rajat | Singing | Hindi |
| 阿文德 | 蟋蟀 | 數學 |
| 沙美爾 | 足球 | 科學 |
| 拉杰夫 | 棋 | 社會科學 |
| 西姆蘭 | 羽毛球 | 英語 |
| 拉賈特 | 唱歌 | 印地語 |
In the above table, there is no connection between the columns of Hobby and Subject. They are both independent of each other.
在上表中,“愛好”和“主題”列之間沒有任何聯系。 它們彼此獨立。
So there is a multivalued dependency, which assists towards unneeded repetition and redundancy of data and other anomalies as well.
因此,存在一個多值依賴關系,它也有助于不必要的重復和數據冗余以及其他異常。
To make the above relation satisfy with the fourth normal form condition and its properties, we can divide the table into two tables, which contain Name and Subject in one table and Name and Hobby in another table.
為了使上述關系滿足第四范式條件及其屬性,我們可以將表分為兩個表,一個表中包含Name和Subject,另一表中包含Name和Hobby。
| Arvind | Cricket |
| Sameer | Football |
| Rajeev | Chess |
| Simran | Badminton |
| Rajat | Singing |
| 阿文德 | 蟋蟀 |
| 沙美爾 | 足球 |
| 拉杰夫 | 棋 |
| 西姆蘭 | 羽毛球 |
| 拉賈特 | 唱歌 |
| Arvind | Maths |
| Sameer | Science |
| Rajeev | Social science |
| Simran | English |
| Rajat | Hindi |
| 阿文德 | 數學 |
| 沙美爾 | 科學 |
| 拉杰夫 | 社會科學 |
| 西姆蘭 | 英語 |
| 拉賈特 | 印地語 |
Now, this relation satisfied the conditions of the fourth normal form.
現在,該關系滿足第四范式的條件。
A table can also contain a functional dependency along with multi-valued dependency. In that case, the functionally dependent columns are transferred in a separate table and the multi-valued dependent columns are transferred to separate tables.
表還可以包含功能依賴項以及多值依賴項。 在這種情況下,功能相關的列將轉移到單獨的表中,多值相關的列將轉移到單獨的表中。
翻譯自: https://www.includehelp.com/dbms/fourth-normal-form-4nf.aspx
數據庫范式5nf
總結
以上是生活随笔為你收集整理的数据库范式5nf_第四范式(4NF)| 数据库管理系统的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: xml不显示css样式_如何使用CSS显
- 下一篇: zzz,zzz,zz9_ZZZ的完整形式