For each FD set below, do the following: 1. Compute the minimal basis 2. Identify all candidate keys for the relation 3. Use the minimal basis to decompose the relation into subrelations and project the minimal basis onto each resulting sub-relation. (see the example below for ideas on how to proceed) Problem 1: B -> C B C D G -> A B E -> C C E F -> B H Problem 2: A F H -> E D F G H -> A E -> C F H -> A D H -> A F G ============================== Example: B -> C D G C F -> G C F G -> D H D -> A B H D H -> B NOTE: I'm being painfully exhaustive here to be sure nobody misses anything. In practice you can probably do fine with far less writing (and you only need one minimal basis per answer). When in doubt, though, the slow way always works. Minimal basis: Closure of LHS: B+ = ABCD..GH CF+ = ABCD.FGH (key) CFG+ = (superkey, see CF+) D+ = ABCD..GH DH+ = (same as D+) Strategy 1: remove cols from RHS Remove B -> CDG? Can't, B not in any other LHS Remove CF -> G? Can't, C, F, CF not in any other LHS Remove CFG -> D? CF -> G has matching LHS, but RHS adds nothing ==> Can't remove CFG -> D Remove CFG -> H? CFG -> D and CF -> G have matching LHS CFG+ = CDFG ==> D has matching LHS = ABCDFGH (same as before!) => CAN remove CFG -> H Remove D -> A? No, A not in any other RHS Remove D -> B? D -> ADH has matching LHS D+ = ADH ==> DH -> B has matching LHS = ABDH ==> B -> CDG has matching LHS = ABCDGH (same as before!) ==> CAN remove D -> B Remove D -> H? D -> ABD has matching LHS D+ = ABD ==> B -> CDG has matching LHS = ABCDG (missing H) ==> Can't remove D -> H Remove DH -> B? D -> AH has matching LHS (recall D->B is deleted) DH+ = ADH (missing B) ==> Can't remove DH -> B FD set remaining: B -> CDG CF -> G CFG -> D D -> ABH DH -> B Strategy 2: remove cols from LHS Remove C from CF -> G? F+ before = F ==> no G in F+ ==> unsafe Remove F from CF -> G? C+ before = C ==> no F in C+ ==> unsafe Remove C from CFG -> DH? FG+ before = FG ==> no C in FC+ ==> Unsafe Remove F from CFG -> DH? CG+ before = CG ==> No F in CG+ ==> unsafe Remove G from CFG -> DH? CF+ before = key ==> G in CF+ ==> Replace CFG -> DH with CF -> DH Remove D from DH -> B? H+ before = H ==> no D in H+ ==> unsafe Remove H from DH -> B? D+ before = ABDH ==> H in D+ ==> Replace DH -> B with D -> B FD set remaining: B -> CDG CF -> DG D -> ABH (notice D->B came back!) Strategy 1 (again): remove cols from RHS Remove B -> C? No, C not in any other RHS Remove B -> D? No, B+ becomes BCG (missing D) Remove B -> G? No, B+ becomes ABCDH (missing G) Remove CF -> D? No, CF+ becomes CFG (missing D) Remove CF -> G? CF+ becomes ABCDFGH (contains G!) ==> Remove! Remove D -> A? No, A not in other RHS (Same applies to D->BH) FD set remaining: B -> CDG CF -> D D -> ABH Strategy 2 (again): remove cols from LHS Remove C from CF -> D? No, F+ = F Remove F from CF -> D? No, C+ = C No change in either strategy. FD set above is minimal basis! Candidate keys? B+ = .B...... (now have B) = .BCD..G. (now have D) = ABCD..GH (missing F, which is not on any RHS) ==> BF is one key CF+ = ..C..F.. (now have CF) = ..CD.F.. (now have D) = ABCD.F.H (now have B) = ABCD.FGH (key!) ==> CF is another key D+ = ...D.... (now have D) = AB.D...H (now have B) = ABCD..GH (missing F, which is not on any RHS) ==> DF is a third key Projection R1(B, C, D, G) R2(C, F, D) R3(D, A, B, H) Projected FD set for R1(B, C, D, G): B -> CDG comes for free Ignore CF -> D (F not in R1) D -> ABH comes also B+ = .BCD..G. = ABCD..GH Add B -> BCDG (AH not in R1) D+ = AB.D...H = ABCD..GH Add D -> BCDG (AH not in R1) No need to consider DB+ (B already in D+) FD set: B -> CDG D -> BCG Minbase of R1: (no need for Strategy 2, all LHS are single col) Remove C from B -> CDG? B+ becomes BCDG (C present) ==> Remove Remove D from B -> DG? B+ becomes BG (D not present) ==> keep Remove G from B -> DG? B+ becomes BCDG (G present) ==> Remove Remove B from D -> BCG? B not in other RHS. ==> keep (same applies for C and G) FDs remaining: B -> D D -> BCG (NOTE: B -> CDG and D -> B also a valid minbase) Projected FD set for R2(C, F, D): Ignore B -> CDG (B not in R) CF -> D comes for free D -> ABH comes (D in R2) D+ = AB.D...H Do not add D -> D (ABH not in R2, D trivial) CF+ = ..CD.F.. Add CF -> D FDs remaining: CF -> D (already in minbase form) Projected FD set for R3(D, A, B, H): B -> CDG comes (B in R3) Ignore CF -> D (CF not in R3) D -> ABH comes for free B+ = .BCD..G. (now have D) = ABCD..GH Add B -> ADH (G not in R3) D+ = AB.D...H (now have B) = ABCD..GH Add D -> ABH FD set: B -> ADH D -> ABH Minbase for R3: (ignore strategy 2, all LHS are single col) Remove A from B -> ADH? B+ becomes BDHA (A present) ==> Remove Remove D from B -> DH? B+ becomes BH (D not present) ==> keep Remove H from B -> DH? B+ becomes BDHA (H present) ==> Remove Remove A from D -> ABH? A no longer in other RHS ==> keep (same reasoning applies for B, H) FDs remaining: B -> D D -> ABH NOTE: other possibilities include at least the following: D -> B and B -> ADH B -> DH and D -> AB