数据库范式5nf_第四范式(4NF)| 数据库管理系统
數(shù)據(jù)庫范式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)是數(shù)據(jù)庫規(guī)范化中使用的范式 ,其中沒有除候選鍵之外的非平凡多值依賴項。 在Boyce-Codd范式(BCNF)之后,4NF是下一級別的規(guī)范化。 盡管第二,第三和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.
當(dāng)且僅當(dāng)表或關(guān)系對于其非平凡多值依賴項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.
當(dāng)且僅當(dāng)滿足以下條件時,帶有屬性,其值和元組的關(guān)系R才為4NF。
The relation or table should be in the Boyce-Codd Normal Form (BCNF).
關(guān)系或表格應(yīng)采用Boyce-Codd范式(BCNF)。
The relation or table should not have any Multivalued Dependency.
關(guān)系或表不應(yīng)具有任何多值依賴關(guān)系。
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.
由多值依賴關(guān)系組成的表違反了第四范式(4NF)的歸一化程度,因為它產(chǎn)生了不必要的冗余,并且可能導(dǎo)致不兼容的數(shù)據(jù),并且不會造成不一致。 為了朝著4NF邁進(jìn),將這些數(shù)據(jù)和信息分成兩個表或關(guān)系很重要。
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.
當(dāng)表或關(guān)系中存在一個或多個行時,即表示同一表或關(guān)系中存在一個或多個其他行,則發(fā)生多值依賴。 用另一種方式,如果我們觀察到,表或關(guān)系中的兩個屬性(或列)彼此不依賴,但是它們兩者都依賴于第三個屬性。 多值依賴項始終至少需要三個屬性,因為它包含至少兩個依賴于第三個屬性。
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)的功能依賴關(guān)系,如果對于P的單個值,存在Q的多個值,則表或關(guān)系可能具有多值依賴關(guān)系。 該表或關(guān)系應(yīng)至少包含三個屬性,并且Q和S不應(yīng)依賴于P->> Q多值依賴關(guān)系。
If the following points are satisfied, then a table or relation has a multivalued dependency,
如果滿足以下幾點,則表或關(guān)系具有多值依賴關(guān)系,
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.
同樣,條件是一個表應(yīng)至少具有三列,以使其具有多值依賴關(guān)系。
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.
并且,對于關(guān)系R(P,Q,S),如果在P和Q之間存在多值依賴關(guān)系,則Q和S不應(yīng)相互依賴。
Example:
例:
Consider a database table which contain student Name, Hobby and subject,
考慮一個包含學(xué)生姓名,愛好和科目的數(shù)據(jù)庫表,
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 |
| 阿文德 | 蟋蟀 | 數(shù)學(xué) |
| 沙美爾 | 足球 | 科學(xué) |
| 拉杰夫 | 棋 | 社會科學(xué) |
| 西姆蘭 | 羽毛球 | 英語 |
| 拉賈特 | 唱歌 | 印地語 |
In the above table, there is no connection between the columns of Hobby and Subject. They are both independent of each other.
在上表中,“愛好”和“主題”列之間沒有任何聯(lián)系。 它們彼此獨立。
So there is a multivalued dependency, which assists towards unneeded repetition and redundancy of data and other anomalies as well.
因此,存在一個多值依賴關(guān)系,它也有助于不必要的重復(fù)和數(shù)據(jù)冗余以及其他異常。
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.
為了使上述關(guān)系滿足第四范式條件及其屬性,我們可以將表分為兩個表,一個表中包含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 |
| 阿文德 | 數(shù)學(xué) |
| 沙美爾 | 科學(xué) |
| 拉杰夫 | 社會科學(xué) |
| 西姆蘭 | 英語 |
| 拉賈特 | 印地語 |
Now, this relation satisfied the conditions of the fourth normal form.
現(xiàn)在,該關(guān)系滿足第四范式的條件。
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.
表還可以包含功能依賴項以及多值依賴項。 在這種情況下,功能相關(guān)的列將轉(zhuǎn)移到單獨的表中,多值相關(guān)的列將轉(zhuǎn)移到單獨的表中。
翻譯自: https://www.includehelp.com/dbms/fourth-normal-form-4nf.aspx
數(shù)據(jù)庫范式5nf
總結(jié)
以上是生活随笔為你收集整理的数据库范式5nf_第四范式(4NF)| 数据库管理系统的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: xml不显示css样式_如何使用CSS显
- 下一篇: zzz,zzz,zz9_ZZZ的完整形式