I'm given the following relation:
R(A,B,C,D,E)
and the following Functional Dependencies:
F1 - AC -> D
F2 - D -> E
F3 - E -> A
I am attempting to convert this to BCNF form.
The first step I took was to figure out the possible keys for the relation.
Keys: ABC, BCD, BCE
Then I checked to see if the functional dependencies fit BCNF form, they do not.
So I attempted to decompose and got the following:
R1(A,C,D) AC->D Keys: AC
R2(D, E) D->E Keys: D
I believe at this point that the relations are in BCNF form and are lossless, but are not dependency preserving.
Does this seem like the right technique for this sort of thing? Is there a step or two I might have missed?
I believe there is an error in your BCNF. Between R1 and R2, you've lost B.
Keys, ABC, BCD and BCE are correct. (You require B, C and one of either A, D or E).
R1 (A, B, C, D), key ABC and R2 (D, E) with key D is a valid normalization.
Related
Consider relation R(A,B,C,D,E). The following functional dependencies are assumed to hold over R:
A -> B, C
B -> D
What is a key of R? If there are multiple candidate keys list all.
I think there is missing FD, but not sure can any one help and also decompose to 3NF.
I am assuming that the two dependencies are a cover of the dependencies of R. In this case, the only candidate key is {A, E}.
A decomposition in 3NF arising from the classical synthesis algorithm is the following:
R1 (A, B, C)
R2 (B, D)
R3 (A, E)
This is a pretty basic question from early on in the semester, which I got wrong. I am asking this for a better and more accurate answer from others in preparation for the final exam.
Normalizing a table with 5 attributes A, B, C, D, and E. Where A and B is a composite key. With no other prime attributes.
a. If you have a partial dependency B to C, what would you do to normalize the relation?
b. If you have a dependency D to E, what would you do to normalize the relation?
Normalization is something that can be done only trough Functional Dependencies. So let's reformulate you question using them.
Normalizing a table with 5 attributes A, B, C, D, and E. Where A and B is a composite key. With no other prime attributes.
This means that we have a relation schema
R(A, B, C, D, E)
with the only non-trivial functional dependency:
A B → C D E
This relation is in Boyce-Codd Normal Form (BCNF) as well as in Third Normal Form (3NF).
If you have a partial dependency B to C, what would you do to normalize the relation?
Now we add the dependency B → C, which violates both the BCNF (that require that each determinant be a superkey) and the 3NF (that tolerates non-superkyes determinant if the determinate is a prime attribute, that is an attribute which belongs to any key, and C is not a prime attribute since the only key is A B).
In this case the normalization is simple, we decompose the original relation R in two relations, the first, R1(B, C), that represent the information that ties B and C, so that we can know for each value of B which is the only corresponding value of C, the second R2(A, B, D, E) that represents the fact the the values of D and E are uniquely determined by a couple of values A and B. The two relations R1 and R2 are both in BCNF and in 3NF, since the key of R1 is B, while the key or R2 is A B.
It is worth mentioning the fact that this decomposition is loss-less and dependency preserving.
If you have a dependency D to E, what would you do to normalize the relation?
Also in this case the strategy is to decompose R in two relations, this time in R1(A, B, C, D) and R2(D, E). Again, we can note that both relations are in BCNF and in 3NF, and that data and dependencies are preserved.
Consider a relation R(A, B, C, D, E) with the following function dependencies: A->BC, D->CE, C->E
AD+ = ABCDE
Prime Attributes: AD
Non-Prime Attributes: BCE
Decomposed into 3NF but not BCNF
R1(A, B, C, D) R2(C,E)
It's been a long time for me since I've done this. But if I remember right in 3NF it is not allowed for a column to be in a table if it is transitively dependent on another column.
In this case, the only transitive dependency is A -> C -> E, which means E needs to be extracted from R.
This you have done to my understanding.
Something tells me you might need to extract C from R1, but that is probably only nessecary in BCNF.
The third normal form in your case is the following:
R1 (A B C)
R2 (C E)
R3 (C D)
R4 (A D)
Note that this is the only way of decomposing your relations in third normal form preserving the dependencies, and that all the resulting dependencies are such that all the decomposed schemas are also in BCNF.
Finally, one can note that the same relation can be decomposed in BCNF in different ways by losing some functional dependency.
I was doing some textbook questions which contain this following one.
Which of the following relations is in Third normal form (3NF)?
a) R(ABCD) FD's: ABD → C ; CD → A ; AC → B ; AC → D
b) R(ABCD) FD's: ABD → C ; A → B ; AB → C ; B → A
c) R(ABCD) FD's: AB → C ; ABD → C ; ABC → D ; AC → D
d) R(ABCD) FD's: AD → C ; D → A ; A → C ; ABC → D
I feel that all four choices are wrong but I do not have the answer to it. Could anybody help me with it? R represents relationship, FD is short term for functional dependency.
(Disclaimer: this is not from test/homework which gives any credit, I just want to make sure that I understand the concept correctly)
The way to prove something is in a certain NF form is by trying to break it. It is hard to describe why something is rather than is not in 3NF. That being said, could you tell me why you think each one does not satisfy 3NF so we can work from there?
This is what I've figured out:
b) Breaks 2NF since candidate key ABD can be broken down into AB which determines non-prime C.
c) Only candidate key is AB. AB -> C. D is determined through a transitive relationship ABC -> D. Breaks 3NF.
d) Candidate key BA determines C. But A -> C, therefore this breaks 2NF.
I could not find anything wrong with a, so that would be my guess to the right answer.
Let me explain it in simple words:
Condition for 3NF:
The non-prime attributes should be dependent only on super key
For option A,
By closure property,
AC+=ABCD
Thus A,C are prime attributes and B,D are non-prime attributes
Since all non-prime attributes are dependent on super key AC
The option A is in 3NF
For option B,
By closure property,
ABD+=ABCD
Thus,A,B,D are prime attributes and C is non-prime attributes
Since C, a non-prime attribute depends on AC which is not a super key,
option B is not in 3NF
For option C,
By closure property,
AB+=ABCD
Thus,A,B are prime attributes and C,D are non-prime attributes
Since D a non-prime attribute depends on AC which is not a super key
option C is not in 3NF
For option D,
By closure property,
AB+=ABCD
Thus,A,B are prime attributes and C,D are non-prime attribute
Since C, a non-prime attribute depends on AD which is not a super key,
option D is not in 3NF
Hope,it helps!!
Given a relation, R = ABCDE
and this set of FD's:
AB > C
DE > C
B > D
I'm able to find the candidate key ABE (correct?)
I need to decompose this relation R into 3NF.
What I don't understand is, by what measure do you decompose? I figure you take the candidate key and the FD's in consideration, but what is the specific process? All that I've looked at has been too dense for me to apply to this small problem.
ABE is the only candidate key.
Start with the tests for 1NF, and show yourself that the existing relation R satisfies 1NF. When you find a normal form that R does not satisfy, fix it.
For example, in testing for 2NF, you see that the FD AB->C is a partial key dependency. (ABE is the only candidate key; C is dependent on only part of that key.) Use projection to remove C from R.
R { ABE CD} is what we started with. After removing C by projection we have
R1 { ABE D}, and
R2 { AB C}
Repeat until all your tables are in 5NF. (R1 is not in 2NF; R2 is in 5NF.)