如何确定功能依赖和多值依赖?

时间:2012-08-20 09:41:18

标签: database functional-dependencies

我有下表

Case ( referenceID, startDate, endDate, caseDetail, caseType, caseTypeRate, 
    lawyerName, lawyerContact, clientID, clientName, clientAddress, clientContact,
    serviceProvided, serviceDate, serviceCost,
    otherPartyID, otherPartyName, otherPartyContact )

我的FD是

 referenceID-->caseDetail
 referenceID-->caseType
 referenceID-->ServiceProvided
 lawyerContact-->lawayerName
 clientID-->clientName  

我是正确还是更多?阅读理论后,我仍然不确定它是如何工作的。我需要明确的例子。我如何确定mvds?

3 个答案:

答案 0 :(得分:3)

功能依赖: - 如果X的一个值只有一个Y值,那么我们可以说Y是功能性依赖于X并写成如下。

X -> Y

多值依赖性: - 如果X的一个值有多个Y值,那么我们可以说Y是对X的多值依赖,它被写成如下。

X ->-> Y

答案 1 :(得分:1)

松散地说,表示为x -> y的函数依赖意味着,“当我知道x的任何值时,我知道y的唯一值。”因此x的值确定y的唯一值。

为了确定是否存在功能依赖,你问自己一个问题,“如果我知道x的任何值,我知道y的唯一值吗?”,然后回答它。

在您的情况下,我猜测这些额外的功能依赖项的大多数将成立。很难确定,因为没有样本数据,因为我不知道列的含义。 (试图仅根据列名确定功能依赖性非常有风险。这里,“startDate”可能意味着什么。)

referenceID -> startDate
referenceID -> endDate
referenceID -> caseType
referenceID -> caseTypeRate
clientID -> clientName
clientID -> clientAddress
clientID -> clientContact
otherPartyID -> otherPartyName
otherPartyID -> otherPartyContact

还有其他人。

维基百科有concise example of a multi-valued dependency

答案 2 :(得分:0)

以下是如何确定MVD的一个很好的示例:https://www.cs.oberlin.edu/~jdonalds/311/lecture08.html

基本上,请遵循以下算法:

1)弄清楚A是否确定B的一组值, 2)弄清楚A是否确定C的一组值,然后 3)确定B和C是否相互独立。

A,B,C是一组属性。如果条件满足那么 A - >> B和A - >> C是MVD。

相关问题