i have the following table
Case ( referenceID, startDate, endDate, caseDetail, caseType, caseTypeRate,
lawyerName, lawyerContact, clientID, clientName, clientAddress, clientContact,
serviceProvided, serviceDate, serviceCost,
otherPartyID, otherPartyName, otherPartyContact )
my FDs are
referenceID-->caseDetail
referenceID-->caseType
referenceID-->ServiceProvided
lawyerContact-->lawayerName
clientID-->clientName
am i correct or are there more? i'm still a bit unsure of how it works after reading the theory. i need clear examples. how do i determine the mvds as well?
Functional dependency:-If one value for X there is only one value of Y then we can say that Y is functionaly dependent upon X and written as follow.
X -> Y
Multivalue dependecy:-If for one value of X there are more than one values of Y then we can say that Y is multivalue dependency upon X and it is written as followes.
X ->-> Y
Loosely speaking, a functional dependency expressed as x -> y means, "When I know any value of x, I know one and only one value of y." So the value of x determines one and only one value of y.
To determine whether a functional dependency exists, you ask yourself the question, "If I know any value for x, do I know one and only one value for y?", and then answer it.
In your case, I'd guess that most of these additional functional dependencies will hold. It's hard to tell for sure, since there's no sample data, and since I don't know what the columns mean. (Trying to determine functional dependencies based solely on column names is very risky. Here, "startDate" could mean just about anything.)
referenceID -> startDate
referenceID -> endDate
referenceID -> caseType
referenceID -> caseTypeRate
clientID -> clientName
clientID -> clientAddress
clientID -> clientContact
otherPartyID -> otherPartyName
otherPartyID -> otherPartyContact
There are others.
Wikipedia has a concise example of a multi-valued dependency.
Here is a good example of how to determine a MVD: https://web.archive.org/web/20140212170321/https://www.cs.oberlin.edu/~jdonalds/311/lecture08.html.
Basically, follow this algorithm:
1) Figure out if A determines a set of values for B,
2) Figure out if A determines a set of values for C, and then
3) Determine if B and C are independent of each other.
A, B, C are a set of attributes. If the conditions are satisfied then
A -->> B and A -->> C are MVDs.
Related
I am currently studying Database Management and we were introduced to the idea of functional dependence:
Let A and B be attributes in a relation. B is considered functionally dependent on A if and only if for every A value you can determine a B value. i.e. A -> B
My question:
If this is the case, then given A, B, and C; if C can be evaluated arithmetically using A and B, can you consider C to be functionally dependent on A and B?
That is, (A/B) = C <=> AB -> C
As an example:
Say I have a table containing online order information. It includes the attributes: PROD_PRICE, QTY, and TOTAL_PRICE.
Seeing as the total price can be established by multiplying PROD_PRICE by the QTY is it accurate to say that PROD_PRICE QTY → TOTAL_PRICE?
If this is the case, then given A, B, and C; if C can be evaluated arithmetically using A and B, can you consider C to be functionally dependent on A and B?
Yes, by definition of functional dependency. In a functional dependency, in general, you have a set of attributes (the “determinant”) that determines another set (the “determinate”), that is each time in an instance of a relation we found the same value of the determinant the determinate must be equal, and this is true if the determinate is obtained as value of an expression over the determinate, like in your example.
Note that in general you do not know which is the function that produces the determinate from the determinant, simply you know that such a function exists. The functional dependency concept captures this fact, which is very important when representing data.
So, if for every row of a table we have c=a/b, then ab->c, but for instance, when PRODUCT_ID -> PRODUCT_NAME holds, there is no mathematical function that can derive the latter from the former.
I'm revising for coming exams, and I am having trouble understanding an example question regarding the closure of attributes. Here is the problem:
AB→C
BE→I
E→C
CI→D
Find the closure of the set of attributes BE, explaining each step.
I've found many explanations of the method of closure when the given step is a single entity type, say 'C', using Armstrong axioms, but I don't understand how to answer for 'BE'.
First, you are confusing two very different things, attributes and entity types. Briefly, entity types are used to describe the real world entities that are modelled in a database schema. Attributes describe facts about such entities. For instance an entity type Person could have as attributes Family Name, Date of Birth, etc.
So the question is how to compute the closure of a set of attributes. You can apply the Armstrong’s axioms, trying at each step to apply one of them, until possible, but you can also simplify the computation by using the following, very simple, algorithm (and if you google "algorithm closure set attributes" you find a lot of descriptions of it):
We want to find X+, the closure of the set of attributes X.
To find it, first assign X to X+.
Then repeat the following while X+ changes:
If there is a functional dependency W → V such as W ⊆ X+ and V ⊈ X+,
unite V to X+.
So in your case, given:
AB → C
BE → I
E → C
CI → D
to compute BE+ we can procede in this way:
1. BE+ = BE
2. BE+ = BEI (because of BE → I)
3. BE+ = BEIC (because of E → C)
4. BE+ = BEICD (because of CI → D)
No other dependency can be used to modify BE+, so the algorithm terminates and the result is BCDEI. In terms of Armstrong’ axioms, the step 1 is due to Reflexivity, while the steps 2 to 4 are due to a combination of Transitivity and Augmentation.
Suppose we have a table with 3 columns A,B and C
A B C
---------------
1 2 3
2 4 5
4 6 7
n 5 n
Here 'n' means null.
Can we say that A -> B and A -> C? I know the definition of functional dependencies but I'm just confused in the case of null values.
If null is considered a value, then the answer is yes. A -> B, C holds in the given data. However, to be a value imposes certain requirements. All operators applicable to the domain (e.g. integers) like equality, addition, less than, and so on, must be well-defined in the presence of nulls.
If null is not a value, then the answer is more complicated. Functional dependencies, strictly speaking, apply to relations. If a table represents a relation, then we can refer to functional dependencies in the table. However, a symbol that represents the absence of a value is metadata, not data. It allows multiple union-incompatible relations to be represented by a single table. In this case, we can't apply the concept of functional dependency to the table since it's not clear which relation we're talking about.
Further confusing things, SQL DBMSs don't handle nulls consistently. In some cases, they're handled like values, in others like the absence of values. If you want to understand and describe a table logically, the best option is to decompose it into a set of null-free relations, and then to analyze each of those parts independently.
In the case of your example table, we run into a problem if null isn't a value. The last row has no unique identifier (it can't be B:4 since another row has B:4 as well) and we can't determine anything from a lack of information. The example can't be decomposed into a set of relations without discarding that row.
If we change the last row to have B:5 instead, then we decompose it into two relations: R1 = {(A:1, B:2, C:3), (A:2, B:4, C:5), (A:4, B:6, C:7)} and R2 = {(B:2), (B:4), (B:6), (B:5)}. We can say A -> B, C holds in R1 but not in R2.
Many books on RDBMS define a relation to be in 4th normal form if for every non-trivial MVD x ->> Y, X is a super key. However I fail to understand how can the determiner X be a super key when we say it multi-determines Y, i.e., Y can have multiple values for a given value of X. A super key is expected to uniquely identify dependent attribute values whereas Y can have multiple values for the same value of X in the MVD. The books give examples for only trivial MVDs.
If y is a subset of x then x-->y is trivial functional dependency (it is well known). But I have doubt: y is not subset of x and x U y = R, then can I say x-->y is a trivial functional dependency.( I read it in some article)
Adding to above question: Why X U Y = R holds in case of multivalued dependencies(trivial)? Can somebody give an example so that I can understand?
No, you can't. Suppose R is {a1, a2} x is a1 and y is a2. x U y = R holds, but x-->y is not necessarily true.
Trivial functional dependency
No it is not a trivial functional. It is only a trivial functional dependency when a subset of attributes depends from the full set.
Definition of trivial functional dependency:
Eg.: (a,b) depends from (a,b,c) attributes.
In you case it is not a subset, so it is not a trivial functional dependency.
What you described is a key candidate. (X depends from itself (trivial), and it also determines all the other part, so this way the whole relation)
Multivalued dependencies
Multivalues dependencies can be threathed like it was some more general version of functional dependencies.
Some help:
Multivalued dependencies on Wikipedia
You can even find some examples there and also the formal definition.