全功能依赖:
如果 X 和 Y 是关系的属性集,则 Y 完全函数依赖于 X,如果 Y 函数依赖于 X 但不依赖于 X 的任何真子集。
例子 –
在关系 ABC->D 中,如果属性 D 完全函数依赖于 ABC 而不是 ABC 的任何真子集,则属性 D 是完全函数依赖于 ABC 的。这意味着 ABC 的子集(如 AB 、BC 、A、B 等)无法确定 D 。
让我们再举一个例子——
供应表
supplier_id | item_id | price |
1 | 1 | 540 |
2 | 1 | 545 |
1 | 2 | 200 |
2 | 2 | 201 |
1 | 1 | 540 |
2 | 2 | 201 |
3 | 1 | 542 |
从表中我们可以清楚地看到,supplier_id 和 item_id 都不能唯一确定价格,但是 supply_id 和 item_id 都可以。所以我们可以说价格在功能上完全依赖于 { supply_id , item_id } 。这总结并给出了我们的完全功能依赖 –
{ supplier_id , item_id } -> price
部分功能依赖:
如果 Y 在函数上依赖于 X 并且 Y 不能由 X 的任何适当子集确定,则函数依赖 X->Y 是部分依赖。
例如,我们有一个关系 AC->B,A->D 和 D->B。
现在如果我们计算 {A + }=ADB 的闭包
这里 A 单独能够确定 B,这意味着 B 部分依赖于 AC 。
让我们再举一个例子——
学生桌
name | roll_no | course |
Ravi | 2 | DBMS |
Tim | 3 | OS |
John | 5 | Java |
在这里,我们可以看到单独的属性 name 和 roll_no 都能够唯一标识一个课程。因此,我们可以说这种关系是部分依赖的。
全功能依赖和部分功能依赖的区别是:
Full Functional Dependency |
Partial Functional Dependency |
A functional dependency X->Y is a fully functional dependency if Y is functionally dependent on X and Y is not functionally dependent on any proper subset of X. | A functional dependency X->Y is a partial dependency if Y is functionally dependent on X and Y cannot be determined by any proper subset of X. |
In full functional dependency , the non-prime attribute is functionally dependent on the candidate key. | In partial functional dependency , non-prime attribute is functionally dependent on part of a candidate key. |
In fully functional dependency, if we remove any attribute of X, then the dependency will not exist anymore. | In partial functional dependency, if we remove any attribute of X, then the dependency will still exist . |
Full Functional Dependency equates to the normalization standard of Second Normal Form . | Partial Functional Dependency does not equate to the normalization standard of Second Normal Form . Rather , 2NF eliminates the Partial Dependency. |
An attribute A is fully functional dependent on another attribute B if it is functionally dependent on that attribute , and not on any part (subset) of it . | An attribute A is partially functional dependent on other attribute B if it is functionally dependent any part (subset) of that attribute . |
Functional dependency enhances the quality of the data in our database. | Partial dependency does not enhance the data quality. It must be eliminated in order to normalize in the second normal form. |