The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
+64 votes
9.9k views

$R(A,B,C,D)$ is a relation. Which of the following does not have a lossless join, dependency preserving $BCNF$ decomposition?

  1. $A \rightarrow B, B \rightarrow CD$
  2. $A \rightarrow B, B \rightarrow C, C \rightarrow D$
  3. $ AB \rightarrow C, C \rightarrow AD$
  4. $A \rightarrow BCD$
asked in Databases by Veteran (59.9k points)
edited by | 9.9k views

4 Answers

+81 votes
Best answer

taking up option A first :
We have, R(A, B, C, D) and the Functional Dependency set = {A→B, B→CD}.
Now we will try to decompose it such that the decomposition is a Lossless Join, Dependency Preserving and new relations thus formed are in BCNF.
We decomposed it to R1(A, B) and R2(B, C, D). This decomposition satisfies all three properties we mentioned prior.

taking up option B :
we have, R(A, B, C, D) and the Functional Dependency set = {A→B, B→C, C→D}.
we decomposed it as R1(A, B), R2(B, C) and R3(C, D). This decomposition too satisfies all properties as decomposition in option A.

taking up option D :
we have, R(A, B, C, D) and the Functional Dependency set = {A→BCD}.
This set of FDs is equivalent to set = {A→B, A→C, A→D} on applying decomposition rule which is derived from Armstrong's Axioms
we decomposed it as R1(A, B), R2(A, C) and R3(A, D). This decomposition also satisfies all properties as required.

taking up option C :
we have, R(A, B, C, D) and the Functional Dependency set = {AB→C, C→AD}.
we decompose it as R1(A, B, C) and R2(C, D). This preserves all dependencies and the join is lossless too, but the relation R1 is not in BCNF. In R1 we keep ABC together otherwise preserving {AB→C} will fail, but doing so also causes {C→A} to appear in R1. {C→A} violates the condition for R1 to be in BCNF as C is not a superkey. Condition that all relations formed after decomposition should be in BCNF is not satisfied here.

We need to identify the INCORRECT, Hence mark option C.

answered by Boss (31.1k points)
selected by
+1
@vijay i was meant "ANY" of table

yeah AC would be super key bcoz union with candidate key would give super key
0
Okay : )
0

anyone please explain this 

In R1 we keep ABC together otherwise preserving {AB→C} will fail, but doing so also causes {C→A} to appear in R1. {C→A} violates the condition for R1 to be in BCNF as C is not a superkey. 

0
Why can't we decompose like R1 like (A,B,C) and R2 like (A,C,D)? Then both tables will be BCNF right?
+1
Because for lossless decomposition common attribute has to be work as a key for any of the decomposed relation.
0
If we decompose as R1(ABC) and R2(CAD),then C is the common attribute and is key for R2. Why are we decomposing as R1(ABC),R2(CD)?
+1
@amitqy

Both will give the same result.

Since given, AB$\rightarrow$C and C$\rightarrow$AD

So rewriting them, AB$\rightarrow$C, C$\rightarrow$A, C$\rightarrow$D

Though R2(CAD) is in BCNF as C$\rightarrow$AD is the only FD present but

R1(ABC) will have FDs AB$\rightarrow$C and C$\rightarrow$A

C$\rightarrow$A violates the BCNF property
0
There is one more decomposition possible for option B i.e R1(A,B), R2(A,D) , R3(B,C) which is also lossless but not dependency preserving .Now, which one to choose between option B and option C and why?
0

@amitqy If we decompose as R1(ABC) and R2(CAD),then AC is the common attribute and AC is not a key in any of the two decomposed relations as the FD for R1 is AB->C and for R2 C->AD.

We can't have AC as a key to get lossless decomposition.

0

@Arjun @vijaycs  @amarVashishth  

If a given relation is decomposed in more than 2 relations then how we can conclude that it is loseless join decomposition.??????   

(How to identify and tackle such problem like option (B) in the above question)

+34 votes
(C) is the answer. Because of AB $\to$ C and C $\to$ A, we cannot have A, B and C together in any BCNF relation- in relation ABC, C is not a super key and C$\to$ A exists violating BCNF condition. So, we cannot preserve  AB $\to$ C dependency in any decomposition of ABCD.

For (A) we can have AB, BCD, A and B the respective keys
For (B) we can have AB, BC, CD, A, B and C the respective keys
For (D) we can have ABCD, A is key
answered by Veteran (384k points)
0
We are not given the candidate keys here so how can we determine that which decomposition is in BCNF....?Please explain....
+2
explanation is not clear.
0
@dhingrak candidate keys won't be given. We have to find them from the FDs.

@Tamojit-Chatterjee I have edited the answer. Is it clear now?
0
hmmm thanx
+1

@Arjun Sir ..I have a doubt regarding dependency preserving- if all attributes of a particular Functional Dependency are not present in any decomposition then we apply the dependency preserving algorithm...

http://www.cs.uakron.edu/~chanc/cs475/Fall2000/ExampleDp%20decomposition.htm

But its application is too lengthy ....is there any other short method..?

0
The steps of that algorithm is lengthy. But if you correctly apply it, it is very easy. I mean for most of the questions, the algorithm stops very fast.
0
That means we need to apply this algo everytime we need to check for functional dependency?
0
Yes. But it can be skipped if you are sure, we cannot check for any dependency without a join of the relations.
+2

Do we need to decompose option D? It is already in BCNF.

Also, can you post BCNF decomposition algorithm?

I am using algorithm 11.3 of Navathe book. But getting different decomposed relation in option C. Keys are AB and BC. So C -> AD not in BCNF. So, decomposition result as BC and CAD.  Please comment.

Algorithm 11.3: Relational Decomposition into BCNF with Nonadditive Join Property
Input: A universal relation Rand a set of functional dependencies F on the attributes of R.
1. Set D := {R};
2. While there is a relation schema Q in D that is not in BCNFdo

   {
      choose a relation schema Q in D that is not in BCNF;
      find a functional dependency X ~ Y in Qthat violates BCNFj
      replace Q in D by two relation schemas (Q - Y) and (X U Y);
   };

0
@Arjun sir can you give the intuition with this algorithm on the link. Will be helpful? not able to get it
0
@Arjun Sir, I think it is silly to ask but why can't we do like:

                    R(A,B,C,D)

                {AB ->C ,  C-> AD}

          R1(ABC)                                   R2(CD)

        AB->C, C->A //NOT IN BCNF             C->D //IN BCNF

R11(ABC)                 R12(AC)

AB->C // IN BCNF        C->A //IN BCNF
0
the decomposition you have ABC AC and CD lossless join and dependency preserving, but it is still not in BCNF. because in ABC $C\rightarrow A$ will still be implied.
0

@Shivansh Gupta thanks!!

0

@Arjun sir @Bikram sir pls look at this once. I have a doubt on c option $AB\rightarrow C, C\rightarrow AD$.

We have 2 algorithms for decomposition, 

1. BCNF decompositoin algorithm, according to this we will get two relations R1(CAD) with $C\rightarrow AD$ and R2(BC) , where $AB\rightarrow C$ is not preserved. So its not possible this way.

But given Schema is also not in 3NF so we can try 3NF atleast.

2. 3NF synthesis algorithm, which makes a relation for each dependency in the minimal cover of given relation A. This guarantees lossless and dependency preserving decompositoin. If we use this in C option then we will get 2 relations R1(ABC) with FD $AB\rightarrow C$ and R2(CAD) with FD $C\rightarrow AD$. So this is in 3NF according to the algorithm, But this also happens to be in BCNF.  

I use this because sometimes through 3NF decomposition we get a BCNF decomposition. Also for $AB\rightarrowC, C\rightarrowA$ the 3NF algorithm gives no decomposition as expected.

Since given that C is wrong, does it mean that we must use only BCNF decompostition algorithm in this case.

+10 votes
(A) A->B, B->CD

AB and BCD, B is the key of second and hence decomposition is lossless.

(B) A->B, B->C, C->D

AB, BC, CD B is the key of second and C is the key of third, hence lossless.

(C) AB->C, C->AD

ABC, CD. C is key of second, but C->A violates BCNF condition in ABC as C is not a key. We cannot decompose ABC further as AB->C dependency would be lost. Hence the ANSWER.

(D) A ->BCD

Already in BCNF.
answered by Veteran (384k points)
+1
Arjun suresh sir, in third option (CAD) nd (BC) lossless decomposition is also possible ???
+1
Yes, that is lossless but AB->C, dependency is not preserved.
0

@ARJUN  sir  we have, R(A, B, C, D) and the Functional Dependency set = {AB→C, C→AD}. 
we decompose it as R1(A, B, C) and R2(C, D). This preserves all dependencies and the join is lossless too, but the relation Ris not in BCNF. In R1 we keep ABC together otherwise preserving {AB→C} will fail, but doing so also causes {C→A} to appear in R1. {C→A} violates the condition for R1 to be in BCNF as C is not a superkey. Condition that all relations formed after decomposition should be in BCNF is not satisfied here..

why  i can not  do  this   R1(ABC)  and  R2(ACD)  ??

0
here AC is common and it is not the key any of the R1 and R2 that's why it is not lossless.
–1 vote
ans C)
answered by Boss (10.4k points)
0
Explain ur reason ...
0

@Puja... i have a question... may be this is really silly but somehow i am not getting this question....

if possible help me..

R(A,B,C,D)

OPTION A :  A ->B, B->CD which can be further written in to B->C , C->D

                    clearly from here in right hand side we dont have A, so the p.k. will surely have A

 so lets find (A)+ --> ABCD ... so we get A is the only primary key right?

and according to the rule B,C,D are non-prime attributes. but in relation's F.D. we have B->C & B-->D where a non prime determines a non prime attribute, which clearly says the relation is not in 3NF also. Then how the hell the relation can be in BCNF? 

can you please explain.... 

+1
@Puja ... Sorry to bother... got this :-P
Answer:

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
47,894 questions
52,261 answers
182,168 comments
67,679 users