0% found this document useful (0 votes)
8 views6 pages

2Q

The document discusses the identification of candidate key attributes from functional dependencies in a relation R(A,B,C,D,E,F,G,H) and provides a step-by-step analysis of closures to determine minimal candidate keys. It also addresses the decomposition of a schema R(A,B,C,D,E) into Boyce-Codd Normal Form (BCNF) by identifying violations and creating new relations to ensure lossless joins. The final BCNF decomposition consists of three relations: R1(A,B,C), R3(B,D), and R4(B,A,E).

Uploaded by

Hemanth Atla
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views6 pages

2Q

The document discusses the identification of candidate key attributes from functional dependencies in a relation R(A,B,C,D,E,F,G,H) and provides a step-by-step analysis of closures to determine minimal candidate keys. It also addresses the decomposition of a schema R(A,B,C,D,E) into Boyce-Codd Normal Form (BCNF) by identifying violations and creating new relations to ensure lossless joins. The final BCNF decomposition consists of three relations: R1(A,B,C), R3(B,D), and R4(B,A,E).

Uploaded by

Hemanth Atla
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

1q.

Identify the NO of CANDIDATE key attributes from the given functinal


dependicies the given relation R(A,B,C,D,E,F,G,H) Ffunctional 10
dependency CH->G,A->BC,B->CFH,E->A,F->EG

Step 1: List the attributes and functional dependencies


 Relation: R(A,B,C,D,E,F,G,H)R(A,B,C,D,E,F,G,H)
 Functional dependencies (FDs):
1. CH→GCH→G
2. A→BCA→BC
3. B→CFHB→CFH
4. E→AE→A
5. F→EGF→EG
Step 2: Find the closure of attributes and determine the key(s)
A candidate key is a minimal set of attributes that can uniquely determine all attributes in the
relation.
Step 2.1: Identify attributes directly determined by each FD
 CH→GCH→G: CHCH determines GG.
 A→BCA→BC: AA determines BB and CC.
 B→CFHB→CFH: BB determines CC, FF, and HH.
 E→AE→A: EE determines AA, which transitively determines BB and CC.
 F→EGF→EG: FF determines EE and GG.

Step 2.2: Find closure of subsets


The closure of an attribute set is the set of attributes that can be functionally determined by it.
We compute closures systematically to determine if a set is a candidate key.
1. Start with subsets of attributes.
2. Check if the closure includes all attributes (A,B,C,D,E,F,G,HA,B,C,D,E,F,G,H).
3. If yes, check if the set is minimal.

Step 2.3: Analyze dependencies


By analyzing dependencies:
 E→A→BCE→A→BC: EE determines A,B,CA,B,C.
 B→CFHB→CFH: BB determines C,F,HC,F,H.
 F→EGF→EG: FF determines E,GE,G.
 Combining results:
 BB determines C,F,H,E,A,GC,F,H,E,A,G (i.e., BB is a key candidate if combined
with DD).
 Other subsets of attributes can also form candidate keys.

 Step 3: Count minimal candidate keys


 The exact number depends on performing closure calculations
exhaustively for all subsets of attributes. Based on the dependencies, the
key attributes would involve B,F,D,CHB,F,D,CH in various
combinations, ensuring minimal coverage.

2Q. Consider thr schema R=(A,B,C,D,E) and thefunctional dependencies


:A->BC , CD->E , B->D , E- >A .Give a lossless join decompostion into
BCNF of the schema.
ANS:-
Step 1: List the attributes and functional dependencies
Relation: R(A,B,C,D,E,F,G,H)R(A,B,C,D,E,F,G,H)
Functional dependencies (FDs):
CH→GCH→G
A→BCA→BC
B→CFHB→CFH
E→AE→A
F→EGF→EG

Step 2: Find the closure of attributes and determine the


key(s)
A candidate key is a minimal set of attributes that can
uniquely determine all attributes in the relation.
Step 2.1: Identify attributes directly determined by each FD
CH→GCH→G: CHCH determines GG.
A→BCA→BC: AA determines BB and CC.
B→CFHB→CFH: BB determines CC, FF, and HH.
E→AE→A: EE determines AA, which transitively
determines BB and CC.
F→EGF→EG: FF determines EE and GG.

Step 2.2: Find closure of subsets


The closure of an attribute set is the set of attributes that
can be functionally determined by it. We compute closures
systematically to determine if a set is a candidate key.
Start with subsets of attributes.
Check if the closure includes all attributes
(A,B,C,D,E,F,G,HA,B,C,D,E,F,G,H).
If yes, check if the set is minimal.

Step 2.3: Analyze dependencies


By analyzing dependencies:
E→A→BCE→A→BC: EE determines A,B,CA,B,C.
B→CFHB→CFH: BB determines C,F,HC,F,H.
F→EGF→EG: FF determines E,GE,G.
Combining results:
BB determines C,F,H,E,A,GC,F,H,E,A,G (i.e., BB is a
key candidate if combined with DD).
Other subsets of attributes can also form candidate keys.

Step 3: Count minimal candidate keys


The exact number depends on performing closure
calculations exhaustively for all subsets of attributes. Based
on the dependencies, the key attributes would
involve B,F,D,CHB,F,D,CH in various combinations,
ensuring minimal coverage.
Would you like me to calculate specific closures to verify
the count?
You said:
Consider thr schema R=(A,B,C,D,E) and thefunctional
dependencies :A->BC , CD->E , B->D , E- >A .Give a
lossless join decompostion into BCNF of the schema.
ChatGPT said:
To decompose the
schema R(A,B,C,D,E)R(A,B,C,D,E) into BCNF (Boyce-
Codd Normal Form), we follow these steps:

Step 1: List the attributes and functional dependencies


Relation: R(A,B,C,D,E)R(A,B,C,D,E)
Functional dependencies (FDs):
A→BCA→BC
CD→ECD→E
B→DB→D
E→AE→A

Step 2: Check for BCNF violations


A relation is in BCNF if, for every functional
dependency X→YX→Y:
XX is a superkey (i.e., X+X+ contains all attributes of the
relation).
Otherwise, the schema violates BCNF and must be
decomposed.

Step 2.1: Determine candidate keys for RR


From the FDs:
E→AE→A: EE determines AA, which
determines B,CB,C.
B→DB→D: BB determines DD.
Therefore, EE determines all attributes
(A,B,C,D,EA,B,C,D,E).
Thus, EE is the candidate key.

Step 2.2: Identify BCNF violations


Check each FD:
A→BCA→BC:
A+={A,B,C}A+={A,B,C}, which is not all attributes.
AA is not a superkey. Violation.
CD→ECD→E:
CD+={C,D,E,A,B}CD+={C,D,E,A,B}, which includes all
attributes.
CDCD is a superkey. No violation.
B→DB→D:
B+={B,D}B+={B,D}, which is not all attributes.
BB is not a superkey. Violation.
E→AE→A:
E+={A,B,C,D,E}E+={A,B,C,D,E}, which includes all
attributes.
EE is a superkey. No violation.

Step 3: Decompose the relation


Step 3.1: Decompose A→BCA→BC
Create two relations:
R1(A,B,C)R1(A,B,C) with A→BCA→BC
R2(A,D,E)R2(A,D,E) with the remaining attributes and
dependencies.
Step 3.2: Decompose B→DB→D in R2R2
Relation R2(A,D,E)R2(A,D,E) violates BCNF
because B→DB→D holds.
Decompose R2R2 into:
R3(B,D)R3(B,D) with B→DB→D
R4(B,A,E)R4(B,A,E) with the remaining attributes.

Final BCNF Decomposition


The final BCNF decomposition is:
R1(A,B,C)R1(A,B,C) with A→BCA→BC
R3(B,D)R3(B,D) with B→DB→D
R4(B,A,E)R4(B,A,E) with E→AE→A
This ensures a lossless join and satisfies BCNF.

You might also like