# Questions on Lossless Join

## Questions on Lossless Join

To Identify whether a decomposition is lossy or lossless, it must satisfy the following conditions :

1. R1  ∪ R2 = R
2. R1  ∩ R2 ≠ Φ and
3. R1  ∩ R2  → R1  or R1  ∩ R2  → R2
```Question 1 :
R(ABC)
F = {A → B, A → C} decomposed into
D = R1(AB), R2(BC)
Find whether D is Lossless or Lossy ?```
```Solution :
D = {AB, BC}
Step 1: AB ∪ BC = ABC
Step 2: AB ∩ BC = B               //Intersection
Step 3: B+ = {B}                  //Not a super key of R1 or R2
⇒ Decomposition is lossy.```
```Question 2 :
R(ABCDEF)
F = {A → B, B → C, C → D, E → F} decomposed into
D = R1(AB), R2(BCD), R3(DEF).
Find whether D is Lossless or Lossy ?```
```Solution :
Step 1: AB ∪ BCD ∪ DEF = ABCDEF = R  // Condition 1 satisfies
step 2: AB ∩ BCD = B
B+ = {BCD}        //superkey of R2
⇒ R12(ABCD)

ABCD ∩ DEF = D
D+ = {D}         // Not a superkey of R12 or R3
⇒ Decomposition is Lossy.```
```Question 3 :
R(ABCDEF)
F = {A → B, C → DE, AC → F} decomposed into
D = R1(BE), R2(ACDEF).
Find whether D is Lossless or Lossy ?```
```Solution :
Step 1: BE ∪ ACDEF = ABCDEF = R  // Condition 1 satisfies
step 2: BE ∩ ACDEF = E
E+ = {E}        //Not a superkey of R1 or R2
⇒ Decomposition is Lossy.```
```Question 4 :
R(ABCDEG)
F = {AB → C, AC → B, AD → E, B → D, BC → A, E → G} decomposed into
(i)  D1 = R1(AB), R2(BC), R3(ABDE), R4(EG).
(ii) D2 = R1(ABC), R2(ACDE), R3(ADG).
Find whether D1 and D2 is Lossless or Lossy ?```
```Solution (i) :
Step 1: AB ∪ BC ∪ ABDE ∪ EG = ABCDEG = R  // Condition 1 satisfies
step 2: AB ∩ BC = B
B+ = {BD}        //Not a superkey of R1 or R2
⇒ Decomposition is Lossy. No need to check further.

Solution (ii) :
Step 1: ABC ∪ ACDE ∪ ADG = ABCDEG = R  // Condition 1 satisfies
step 2: ABC ∩ ACDE = AC
AC+ = {ACBDEG}        //superkey
⇒ R12(ABCDE)

⇒ R123(ABCDEG)
⇒ Decomposition is LossLess.```
```Question 5 :
R(ABCDEFGHIJ)
F = {AB → C, B → F, D → IJ, A → DE, F → GH} decomposed into
(i)   D1 = R1(ABC), R2(ADE), R3(BF), R4(FGH),R5(DIJ).
(ii)  D2 = R1(ABCDE), R2(BFGH), R3(DIJ).
(iii) D3 = R1(ABCD), R2(DE), R3(BF), R4(FGH),R5(DIJ).
Find whether D1, D2 and D3 is Lossless or Lossy ?```
```Solution (i) :
Step 1: ABC ∪ ADE ∪ BF ∪ FGH ∪ DIJ = ABCDEFGHIJ = R  // Condition 1 satisfies
step 2: ABC ∩ ADE = A
A+ = {ADEIJ}        //Superkey of R2
⇒ R12(ABCDE)

ABCDE ∩ BF = B
B+ = {BFGH}         //superkey of R3
⇒ R123(ABCDEF)

ABCDEF ∩ FGH = F
F+ = {FGH}          //Superkey of R4
⇒ R1234(ABCDEGH)

ABCDEFGH ∩ DIJ = D
D+ = {DIJ}          //Superkey of R5
⇒ R12345(ABCDEGHIJ)
⇒ Decomposition is LossLess.

Solution (ii) :
Step 1: ABCDE ∪ BFGH ∪ DIJ = R  // Condition 1 satisfies
step 2: ABCDE ∩ BFGH = B
B+ = {BFGH}        //Superkey of R2
⇒ R12(ABCDEFGH)

ABCDEFGH ∩ DIJ = D
D+ = {DIJ}         //superkey of R3
⇒ R123(ABCDEFGHIJ)
⇒ Decomposition is LossLess.

Solution (iii) :
Step 1: ABCD ∪ DE ∪ BF ∪ FGH ∪ DIJ = ABCDEFGHIJ = R  // Condition 1 satisfies
step 2: ABCD ∩ DE = D
D+ = {DIJ}        //Not a super key of R1 or R2
⇒ Decomposition is Lossy. No need to check further. ```

### Incoming search terms:

• lossless join
• toughest question lossless decompostion
• lossless sample question
• lossy and non lossy identification
• lossless and lossy decomposition check
• losseless or lossy in dbms example
• how to do decomposition and check for lossy and lossless
• how to check whether a decomposition is lossy or lossless with example
• examples on lossless decomposition
• easy questions on lossy loseless decoposition

In Question 5, D3 is lossy. D+ is neither a superkey of R1 or R2.

• Thanks for the correction Aditya 🙂