Is this statment correct?
"A Prime attribute can be transitively dependon a key in a BCNF relation" ?
according to me it is wrong
if it is wrong then what is the Normal Form of given Relation
R(A,B,C,D) and its functional dependency set is { AB->C ,AB->D , CD->A ,CD->B ,AB->CD }
A BCNF relation can satisfy a transitive FD like A->B->C only if A and B are both superkeys or if either A->B or B->C is trivial.
Gramatical errors aside the statement is strictly correct - it's just not very interesting or useful. Normally we are interested in whether a relation satisfies any non-superkey, non-trivial FDs, which are the ones that BCNF prohibits. I suggest you recheck the quotation to make sure you have it right.
Related
Assume that the relation is obtained through decomposition from a relation with attributes ABCDEFGHI and that dependencies over ABCDEFGHI are listed below.
R(A,B,F)
B->E
A->F
We need to convert this relation into BCNF
What i have done till now is
R1(AB)
R2(AF)
R3(BE)
Is there anything more I should do? Is this proper BCNF or am I missing something?
This answer follows from the edited question, under the following hypotheses:
the original relation is R(ABCDEFGHI)
a cover of the functional dependencies holding on it is {B->E, A->F}
Of course if my hypotheses are wrong the answer is wrong!
In this case:
the only candidate key of the original relation is ABCDGHI;
in the decomposed relation R1(ABF) the only non-trivial dependency that holds is A -> F, so the relation has the only candidate key AB;
the relation is not in BCNF, and a decomposition in BCNF is {R2(AF), R3(AB)}
Note that you cannot decompose a relation adding an extraneous attribute, like E in your decomposition.
I have a set of functional dependencies:
V = {ABCDEF} F = {AB → CD,ABDE → F,BC → A,C → DF}
Candidate keys are: {ABE, BCE}
Canonical cover is: {AB→ C, BC→ A, C→ DF} [This is what I think, might be wrong]
However, as you can see an attribute of candidate key, E, is not in my canonical cover and as far as I know candidate keys should be same in the canonical cover.
If you consider Augmentation rule from Armstrong calculus we can say it is correct but I am confused. Does attribute E have to be represented in the canonical cover?
You say:
as far as I know candidate keys should be same in the canonical cover
This is not true. On the contrary, if an attribute does not belong to any right part of the functional dependencies of a canonical cover, it must be present in any candidate key (this is because it cannot be derived from any other subset of attributes, so, since a candidate key must determines all the attributes, it should be present in any key). Your canonical cover and candidate keys are correct.
Note that if an attribute does not belong to any functional dependency (both in the left and right part), as E in your example, this is a special case of above (it does not belong the a right part side), and must be present in any candidate key.
Finally, note that this can be considered a “symptom” of something wrong in the relation and in fact the schema is not in 3NF or BCNF.
Well, when I try to do Bernnstein synthesis from this relation (ABCDEF) I have to use basis: {AB→C,BC→A,C→DF} I need to add candidate keys since no candidate key exist when we form a relation from functional dependencies : R1(ABC) and R2(CDF) and I was wondering if we need to add E here since our basis doesn't contain E and we consider basis when we do synthesis. That's why I was little confused. But, I think we need to add E since we are doing a synthesis from original R(ABCDEF) so it should be R1(ABC), R(CDF) and R3( ABCE). R3 contains all candidate keys.
If a relation is decomposed into 2 sub relations such that the decomposition is lossy then can these sub-relations be in any normal form (3nf or bcnf) if the parent relation is in bcnf ?
Consider a relation R(S,T,U,V) with following functional dependencies:-
S->T , T->U, U->V, V->S.
Now if I decompose the above relation into 2 relations R1 and R2 such that R1 intersection R2 is null like R1(S,T) and R2(U,V) , then is the decomposition in bcnf?
I know that R1 can have functional dependencies S->T, T->S and R2 can have functional dependencies U->V and V->U which makes it look like BCNF.
My question was do we consider the decomposition as BCNF even though it's not a valid decomposition ? By not valid I mean lossy decomposition.
From your (unclear) question:
If a relation is decomposed into 2 sub relations such that the decomposition is lossy
From a comment:
I just asked if there is a possibility that the decomposed relations be in bcnf if the parent relation is in bcnf
If that's your question then the answer is yes, there is.
Consider a variable with CK (candidate key) {a} in BCNF that can hold this:
a b
1 2
3 4
Binary decomposition {{a},{b}} is lossy with components in BCNF.
(When trying to prove something wrong always check out some simple cases in case you can find a counterexample as proof.)
do we consider the decomposition as BCNF even though it's not a valid decomposition ? By not valid I mean lossy decomposition.
When we say that a decomposition is in a certain NF, that's short for saying that all its components are in that NF. But we only ever use this shorthand when the decomposition is lossless, ie when "decomposition" is understood to be short for "lossless decomposition", because lossy decompositions are not useful.
Hey all I have an assignment that says:
Let R(ABCD) be a relation with functional dependencies
A → B, C → D, AD → C, BC → A
Which of the following is a lossless-join decomposition of R into Boyce-Codd Normal Form (BCNF)?
I have been researching and watching videos on youtube and I cannot seem to find how to start this. I think I'm supposed to break it down to subschemas and then fill out a table to find which one is lossless, but I'm having trouble getting started with that. Any help would be appreciated!
Your question
Which of the following is a lossless-join decomposition of R into
Boyce-Codd Normal Form (BCNF)?
suggests that you have a set of options and you have to choose which one of those is a lossless decomposition but since you have not mentioned the options I would first (PART A) decompose the relation into BCNF ( first to 3NF then BCNF ) and then (PART B) illustrate how to check whether this given decomposition is a lossless-join decomposition or not. If you are just interested in knowing how to check whether a given BCNF decomposition is lossless or not jump directly to PART B of my answer.
PART A
To convert a relation R and a set of functional dependencies(FD's) into 3NF you can use Bernstein's Synthesis. To apply Bernstein's Synthesis -
First we make sure the given set of FD's is a minimal cover
Second we take each FD and make it its own sub-schema.
Third we try to combine those sub-schemas
For example in your case:
R = {A,B,C,D}
FD's = {A->B,C->D,AD->C,BC->A}
First we check whether the FD's is a minimal cover (singleton right-hand side , no extraneous left-hand side attribute, no redundant FD)
Singleton RHS: All the given FD's already have singleton RHS.
No extraneous LHS attribute: None of the FD's have extraneous LHS attribute that needs to e removed.
No redundant FD's: There is no redundant FD.
Hence the given set of FD's is already a minimal cover.
Second we make each FD its own sub-schema. So now we have - (the keys for each relation are in bold)
R1={A,D,C}
R2={B,C,A}
R3={C,D}
R4={A,B}
Third we see if any of the sub-schemas can be combined. We see that R1 and R2 already have all the attributes of R and hence R3 and R4 can be omitted. So now we have -
S1 = {A,D,C}
S2 = {B,C,A}
This is in 3NF. Now to check for BCNF we check if any of these relations (S1,S2) violate the conditions of BCNF (i.e. for every functional dependency X->Y the left hand side (X) has to be a superkey) . In this case none of these violate BCNF and hence it is also decomposed to BCNF.
PART B
When you apply Bernstein Synthesis as above to decompose R the decomposition is always dependency preserving. Now the question is, is the decomposition lossless? To check that we can follow the following method :
Create a table as shown in figure 1, with number of rows equal to the number of decomposed relations and number of column equal to the number of attributes in our original given R.
We put a in all the attributes that our present in the respective decomposed relation as in figure 1. Now we go through all the FD's {C->D,A->B,AD->C,BC->A} one by one and add a whenever possible. For example, first FD is C->D. Since both the rows in column C has a and there is an empty slot in second row of column D we put a a there as shown in the right part of the image. We stop as soon as one of the rows is completely filled with a which indicates that it is a lossless decomposition. If we go through all the FD's and none of the rows of our table get completely filled with a then it is a lossy decomposition.
Also, note if it is a lossy decomposition we can always make it lossless by adding one more relation to our set of decomposed relations consisting of all attributes of the primary key.
I suggest you see this video for more examples of this method. Also other way to check for lossless join decomposition which involves relational algebra.
Say I have a relation ABCD with FD's (A->D and AB -> ABCD)
Will a decomposed relation ABC be in BCNF? According to the second FD, AB form a key and is therefore in BCNF, but if you only look at the FD A -> D, is the relation no longer in BCNF then?
If you decompose a given relation schema (to which given dependencies apply), the next task is to determine, for each individual dependency in the original set :
(a) which (if any) of the new, decomposed, schemas does it apply to ?
(b) how has the decomposition affected the very definition of the FD ?
Question (a) applies to your original A->D dependency.
Question (b) applies, sort of, to your original AB->ABCD dependency. I say "sort of" because that version is quite "overstated". Given that A->D was already a given, it could just as well just say AB->C.