I'm having difficulties understanding BCNF decomposition.
If I have:
R=(A,B,C)
FDs: AB -> C, C -> B
Computing the closure, I have concluded that the minimal keys are {AB} and {AC}.
Therefore,
AB --> C is NOT in BCNF violation because AB is a key
C --> B IS in violation because C is not a key.
I decompose C --> B like this
R1 = Closure of C = (C,B)
R2 = (A,C)
Im unsure how to proceed from here. If it needs to be further decomposed, what do I need to do? If I am supposed to end here, how do you know when to stop decomposing?
Computing the closure, I have concluded that the minimal keys are {AB} and {AC}.
The candidate keys of R are {AB} and {AC}.
You decompose R into these two relations, and you identify all the candidate keys in each of those relations.
R1 {AB -> C}
R2 {C -> B}
The only candidate key to R1 is {AB}.
The only candidate key to R2 is {C}. The attribute {C} is not a key in R, but it is a key in R2.
R1 and R2 are when you stop. After the decomposition you identify the keys and the functional dependencies in the new relations. The key in R1 is C (with FB: C -> B, no BCNF violation), the key in R2 is AC (no BCNF violation either).
Write the closure for AB->C and C->B:
{A,B}+ = {A, B, C}
{C}+= {C, B}
A+B is a superkey hence it is not violating BCNF. So we use the violating FD (C->B) to do the decomposition.
{A, B, C} - {B, C} = {A}
Then add left side of C->B to {A} and will have {A, C} and {B, C}
Hence we decompose the R(A, B, C) into R(B, C) and R(A, C).
Related
My exam answers key and my answer (and answers of online tools) are different for the typical "Determine highest normal form of relation" question and I want to know why.
Exam question: For the given relation R with schema H = {A, B, C, D, E} and functional dependencies F = {{B, C} -> {D, E}, {C, D} -> {B, E}, {D} -> {C}, {E} -> {B}}. Determine the highest normal form of R. Assume it's in the 1NF.
My answer:
I already have 1NF. Next I check 2NF.
To do that, I need candidate keys. "A" is not in any dependency, so it has to be in the key. I can also add "D", and from {D} -> {C} I have {A, C, D}. Then from {C, D} -> {B, E} I have all {A, B, C, D, E}, so the {A, D} is indeed a candidate key. I can do the same for {A, B, C} and {A, C, E}, so I have candidate keys: {A, D}, {A, B, C}, {A, C, E}.
2NF requires that "no non-prime attribute can be functionally dependent on any proper subset of any candidate key; a non-prime attribute is not a part of any candidate key of the relation". But I have {B, C} -> {D, E}, so E (a non-prime attribute) depends on {B, C} (a proper subset of {A, B, C}), so it's not in 2NF. Therefore it's only in 1NF.
The exam answer:
The relation is in the 3NF. Also this handy tool which checks normal form tells me it's 3NF.
My question:
Is this in 1NF or 3NF? My only doubt is for {B, C} -> {D, E} dependency. As I've written above, E is non-prime, but {D, E} as the whole contains 1 prime and 1 non-prime attribute. Do I make some mistake here?
Assuming F a cover of the functional dependences of R, you are correct assuming that the candidate keys are AD, ABC and ACE. So all the attributes are primes, no dependency can violate the 3NF, the relation is in 3NF, and for this reason it is also in 2NF.
I'm struggling with finding a minimal basis for the given relation and FD's. Can you please confirm I'm doing it right?
I've got R(A, B, C, D, E, F, G)
A -> G
E -> F,G
C,D -> B
B -> E
C,D -> A
After checking each FD there is nothing to remove, so my minimal basis is
A -> G
E -> F
E -> G
C,D -> B
B -> E
C,D -> A
and the key is (C,D) as (C,D)+ = (C,D,A,B,E,F,G)
Many thanks
In American English, I think the term is minimal cover.
CD is the only candidate key in R.
I'm not sure what you mean by "checking each FD", but your result is right.
I have 2 sets
R = {A B C D}
H = {AB-> C , AB-> D, D-> B}
Want to find all minimal keys in R set
My answer for minimal keys is : { A D }
this is because
AB -> C and AB -> D then AB -> CD
since D -> B then AD is the minimal keys
when i check my answer with this site. the site giving wrong answer.
can explain?
The site says, "Set of found candidate-keys: {{A, C, F}, {B, C, F}}." That's clearly wrong; F isn't even in R.
In any case, your answer is incomplete. AD is one of two candidate keys.
Here is a group of FDs(3NF):
A-> BDEFG
CF->A
BG->C
How can I decompose this relation to BCNF?
I guess there are still dependencies in CF->A because A->F, but have no idea how to decompose it..
Anyone can help please?
Thanks!
For FD 1 and FD 2, you can see that A and CF are both keys of this relation and these FDs do not violate BCNF. For FD 3, BG is not the key so you need to decompose into : {B G C} AND { B G A D E F} according to the decomposing algorithm. Now it's done since {B G C} corresponds to FD 3 and { B G A D E F} satisfies with FD 1. Hope this helps.
I have this problem:
R = (A, B, C, D, E)
and
F = (A -> BC, B -> CD, E -> AD)
the book says that this in BCNF because all FDs are trivial.
My question is: how this FDs is trivial?
by what you've posted :
R = ABCDE
A -> BC
B -> CD
E -> AD
the candidate key is E
All the left hand side FDs do not show E so this is not a BCNF.
and hence the non trivial FD.