The number of different minimal cover possible are? - database

Consider R(A,B,C,D,E,F,G) be a relational schema with the following functional dependencies:
AC->G, D->EG, BC->D, CG->BD, ACD->B, CE->AG. The number of different minimal cover possible are___________?
Actually in this question we were supposed to find all the possible minimal covers. I used this video
So using that theory i tried doing this question but end up getting only 2 minimal covers and then answer given in my text book is 4 .
The minimal covers I got are:
1)
D->E,D->G,BC->D,CG->D,AC->B(#),CE->A
2)
AC->G,D->E,D->G,BC->D,CG->D,CD->B(#),
CE->A
Actually the video gives only standard procedure to FIND a minimal cover. but the problem is a bit tricky as it asks about how MANY minimal covers we can find. I am applying the algorithm right...the only issue is that I am unable to find how many more minimal covers can be possible for the given set of FD's

A common algorithm to produce a minimal cover consists of three steps:
Split the right part, producing FDs with only one attribute on the right part.
For each left part with more than one attribute, try to remove each attribute in turn and see if the remaining can still determine the right part. In this case, eliminate the attribute from the left part.
For each remaining dependency, try to see if it can be eliminated.
In your case the first step produces:
F = { A C → G
A C D → B
B C → D
C G → B
C G → D
C E → A
C E → G
D → E
D → G }
In the second step, we must check the first seven dependencies. For each dependency A1A2...An -> B we try to eliminate in turn each Ai and see
if B is included in the closure of the remaining attributes (the closure taken with respect to F). In this case we have two possibilities: from ACD -> B we can eliminate either A or D. So we have now two different set of dependencies:
F1 = { A C → G
C D → B
B C → D
C G → B
C G → D
C E → A
C E → G
D → E
D → G }
and
F2 = { A C → G
A C → B
B C → D
C G → B
C G → D
C E → A
C E → G
D → E
D → G }
Now we can apply the last step: for each dependency X -> A we can see if A is included in the closure of X, X+ with respect to all the other dependencies. In this case, we can eliminate that dependency.
The result will depend, in general, from the order in which we apply those checks.
Here there are four different canonical covers:
G1 = { A C → G
B C → D
C G → B
C E → A
D → E
D → G }
G2 = { A C → G
B C → D
C G → D
C E → A
C D → B
D → E
D → G }
G3 = { A C → B
B C → D
C G → B
C E → A
D → E
D → G }
G4 = { A C → B
B C → D
C G → D
C E → A
D → E
D → G }
Note: it is not clear to me if there are other canonical covers.

Related

Finding the canonical cover? [duplicate]

I have a relation r(A,B,C,D,E,F) satisfying:
AB->C
C->A
BC->D
ACD->B
BE->C
CE->FA
CF->BD
D->EF
I need to find the canonical cover for this relation?
I know the algorithm to find the canonical cover. However in the algorithm, we need to find the extraneous attributes. Is there an algorithm to find extraneous attributes?
The algorithm to find extraneous attributes is the following:
let F the initial set of functional dependencies
assume that each dependency F is in the form A1, A2, ..., An -> B
for each functional dependency A1, A2, ..., An -> B in F with n > 1
for each Ai
if B ∈ ({A1, A2, ..., An} - Ai)+
then Ai is an extraneous attribute and must be removed from the left hand side
Note that the closure of the remaining attributes must be computed by considering all the dependencies of F, including the dependency under examination (this can be counterintuitive).
For instance, applying this algorithm to your example, starting from the dependencies:
{ A B → C
A C D → B
B C → D
B E → C
C → A
C E → A
C E → F
C F → B
C F → D
D → E
D → F }
In A C D → B, A is estraneous since {C D}+ = (A B C D E F), while in C E → A, E is estraneous since {C}+ = (A C).

How to find the extraneous attributes of functional dependency?

I have a relation r(A,B,C,D,E,F) satisfying:
AB->C
C->A
BC->D
ACD->B
BE->C
CE->FA
CF->BD
D->EF
I need to find the canonical cover for this relation?
I know the algorithm to find the canonical cover. However in the algorithm, we need to find the extraneous attributes. Is there an algorithm to find extraneous attributes?
The algorithm to find extraneous attributes is the following:
let F the initial set of functional dependencies
assume that each dependency F is in the form A1, A2, ..., An -> B
for each functional dependency A1, A2, ..., An -> B in F with n > 1
for each Ai
if B ∈ ({A1, A2, ..., An} - Ai)+
then Ai is an extraneous attribute and must be removed from the left hand side
Note that the closure of the remaining attributes must be computed by considering all the dependencies of F, including the dependency under examination (this can be counterintuitive).
For instance, applying this algorithm to your example, starting from the dependencies:
{ A B → C
A C D → B
B C → D
B E → C
C → A
C E → A
C E → F
C F → B
C F → D
D → E
D → F }
In A C D → B, A is estraneous since {C D}+ = (A B C D E F), while in C E → A, E is estraneous since {C}+ = (A C).

Is A → B the same as B → A when speaking of functional dependencies?

This might very simple but I just had to check with you guys.
When it comes to databases, does the arrow in literature imply vise versa on equality?
Meaning, is A → B considered the SAME as B → A, in particular when it comes to databases and functional dependencies?
Please read the reference(s) you were given for FDs (functional dependencies).
A FD is an expression of the form "A → B" for sets of attributes A & B. So if A and B are different, A → B is a different FD than B → A.
For a relation value or variable R, "A → B holds in R" and "A → B in R" say that if two R tuples have the same subtuple for A then they have the same subtuple for B.
Is A → B in R equivalent to B → A in R? If A and B are the same set, then yes. But what if they aren't?
X Y
a 1
b 1
{X} → {Y} holds in that relation value. {X} <> {Y}. Does {Y} → {X} also hold?

How to transform this into Boyce-Codd Normal Form?

I don't understand what I am doing wrong here. This is what I am being asked:
Normalize the following schema into BNCF:
T ((A, B), C, E, F, G)
The functional dependencies besides the key are:
A, B → C, E
F, B, A → G
B → B
F, C → C, G, E
C, F → E
E → G, E
So, I came up with this:
T ((A, B), C, E, F)
X((A,B), C, E)
W ((F,B,A), G)
Q ((B))
L ((F,C), G, E)
J ((C,F), E)
R ((E),G)
But it gives me this error:
Result is not as expected. Modify your input and try again.
And I have no clue where the error is. Can someone explain to me what I should do?
If the nested parentheses indicate a CK (candidate key) then
A, B → C, E is implied by the CK
F, B, A → G ditto
B → B is trivial
F, C → C, G, E is implied by F, C → G, E
C, F → E is redundant given F, C → G, E
E → G, E means F, C → G, E is implied by F, C → E
{A, B} being a CK means A, B → C, E, F, G, plus we have F, C → E and E → G. We can use a BCNF algorithm to get a decomposition comprising ((A, B), C, F) plus your J ((C,F), E) and R ((E), G).
You don't explain your solution (what BCNF algorithm you are using and what choices you made). But note that the FDs that hold in a relation are all the ones generated by Armstrong's axioms when some explicitly given ones hold. (Including the ones that hold because we were told a CK.) Also note that in one BCNF algorithm when we pick some FD (functional dependency) X → Y that holds in schema R that violates BCNF we replace R by schemas X+ and R - (X+ - X); and the set of FDs used is the closure of the explicitly given ones.

Can BCNF decomposition preserve all functional dependencies given F = {AB -> E, BC -> G, C-> BG, CD->A, EC->D, G->CH}?

Given F = {AB -> E, BC -> G, C-> BG, CD->A, EC->D, G->CH}, perform a BCNF decomposition and check whether it preserves all functional dependencies.
The minimal cover is R = {AB->E,C->B,C->G,CD->A,EC->D,G->C,G->H}
I performed on R a BCNF decomposition(it is a must to perform on the minimal cover) and I stayed with two dependencies of which one is preserved and one isn't preserved. In the answers they tell me that all of the dependencies are preserved. Can please anyone confirm this?
ABE, CBG, CDA, CED, GCH are in BCNF and loosless join and dependency preserving. relation keys are in bold
There is always a possibility to add a new relation for preserving a dependency as long as this new relation is in BCNF.
Starting from the canonical cover, we can see that the determinant of A B → E is not a superkey and so R can be replaced by:
R1 < (A B E) , { A B → E } >
and:
R2 < (A B C D G H) ,
{ G → C
G → H
C → B
C → G
C D → A
A B C → D } >
In R2 the determinant of G → C is not a superkey and so R2 can be replaced by:
R3 < (B C G H) ,
{ G → C
G → H
C → B
C → G } >
and:
R4 < (A D G) ,
{ D G → A
A G → D } >
So, the final decomposition is:
R1 < (A B E) ,
{ A B → E } >
R3 < (B C G H) ,
{ G → C
G → H
C → B
C → G } >
R4 < (A D G) ,
{ D G → A
A G → D } >
and the dependency:
{ C E → D }
is not preserved.

Resources