I was working on some questions and found this relation R(A, B, C, D, E) with FDs {A -> B, B -> A, B -> E, AC -> D}.
I worked it out to find that it was in 3NF.
But the solution key for the question paper where I came across this said it was in 1NF. According to it, B -> E was a partial dependency, so R couldn't be in 2NF. Can anyone please explain to me the logic behind this?
A relation is in 2NF if any non-prime (i.e. not belonging to a candidate key) attribute is fully functionally dependent on a candidate key.
This definition implies that, if a dependency X → A can be derived in which A is not a prime attribute and X is a proper subset of a candidate key, then such dependency violates the 2NF.
This is the case of your example: the candidate keys are AC and BC, so D and E are non-prime attributes; the dependency B → E has a determinant which is not a candidate key, but only a subset of a key, so the relation is not in 2NF.
Finally note that the 2NF has only historical interest, and the normalization process is discussed in many books (and formal algorithms are presented) only for BCNF, 3NF and higher normal forms.
Related
R1(A, B, C, D) is a relation. It is specified that every attribute has only atomic values, and there is a set of dependencies (BD->C, C->A). It's clear to me that the relation is in the 1NF, but is it in the 2NF? I mean, BD is obviously a primary key, and we can conclude that BD->A, so all the attributes depend on the key. It isn't in the 3NF, for sure, because the 3NF doesn't accept transitive dependencies, but this shouldn't be a problem for the 2NF. I'm having doubts because some people told me that this couldn't be in 2NF. Is my reasoning correct? Is it in 2NF or not?
A relation schema is in 2NF if any non-prime (i.e. not belonging to a candidate key) attribute is fully functionally dependent on a candidate key.
This definition implies that, if a dependency X → A can be derived in which A is not a prime attribute and X is a proper subset of a candidate key, then such dependency violates the 2NF.
Since the (only) candidate key of this relation is BD, the attributes A and C are non-primes.
Since BD → C, is given, and BD → A can be derived, while neither B → A or D → A can be derived, then the relation is in 2NF.
Note that the 2NF has only historical interest, and the normalization process is discussed in many books (and formal algorithms are presented) only for BCNF, 3NF and higher normal forms.
Consider the table with attributes A and B
A B
222 Jack
222 Jill
222 Joe
Here A ->-> B holds true. My book says that the above relation is in 4NF.
I don't understand how it can be in 4NF as for a relation to be in 4NF, A should be a super key for that relation if there is a MVD of form A->->B.
Here how is A a super key ? For same value of A (222), we have multiple values of B.
That relation isn't even in 2NF
My book says that the above relation is in 4NF
Why do you say that? What is your book? That relation value has sole CK {B} but satisfies the FD {} -> A which is a partial dependency of a non-prime attribute on a CK so it isn't even in 2NF.
Your implication is wrong
for a relation to be in 4NF, A should be a super key for that relation if there is a MVD of form A->->B
Let us simplify that complicated phrasing: if a relation is in 4NF then if MVD (multi-valued dependency) {A} ->> {B} holds then {A} is a superkey.
From Wikipedia:
A table is in 4NF if and only if, for every one of its non-trivial multivalued dependencies X ↠ Y, X is a superkey
This tells us that if a relation is in 4NF then if non-trivial MVD X ->> Y holds then X is a superkey.
So it doesn't tell us what you claimed. You left out "non-trivial".
But since the relation isn't in 4NF the inner implication doesn't matter.
That MVD is trivial so if we had 4NF then the inner implication wouldn't apply
In your relation {A} ->> {B} holds, but it is trivial since {A} U {B} is the set of all attributes and
A trivial multivalued dependency X ↠ Y is one where either Y is a subset of X, or X and Y together form the whole set of attributes of the relation
So if the relation were in 4NF then {A} would not have to be a superkey.
(The (trivial) (binary) JD (join dependency) corresponding to the MVD is *{{A}, {A, B}}, ie the relation is the join of its projections on {A} & {A, B}.)
Other MVDs hold that violate 4NF
The definition tells us that a relation being in 4NF requires that if a non-trivial MVD X ->> Y holds then X is a superkey.
If you list all the MVDs relevant to that relation then you will find that they are all trivial except {} ->> {A} and {} ->> {B}. It happens that both of those hold. (They express the same condition, that the same JD holds, that the relation is a certain join.) But {} isn't a superkey. So 4NF is violated.
(In terms of JDs: The only possible non-trivial binary JD is *{{A}, {B}}, which happens to hold. But that is not implied by the CKs, ie it doesn't have to hold when the CK set is {{B}}, ie (per Fagin's membership algorithm) the join of its two elements is not on a common column set that includes a CK of both. So the relation is not in 4NF.)
But we already know 4NF is violated, because we know 2NF is violated.
I read a statement that " If a relation is in 3NF and does not contain any overlapping candidate key then it is definitely in BCNF"
Suppose we consider a relation R(A,B,C,D) with following functional dependencies:-
AB --> CD
C --> A
Here only candidate key is AB and the resulting relation is in 3NF and not in BCNF because C is not a super key.
So the above statement doesn't hold true.
Where am I going wrong ?
Your relation has overlapping candidate keys. While it doesn't appear on the left-hand side of the given functional dependencies, we can derive the fact that BC is a candidate key.
Starting with C -> A, we can use Armstrong's Axiom of Augmentation to determine that CB -> AB, and since it's known that AB is a candidate key, that means all other attributes are determined.
If I have the following relation R = (A, B, C, D)
And the functional dependencies:
A -> B, B -> A, CDB -> A, CDA -> B
The candidate keys are CDA and CDB.
The third normal form says that there can not be a functional dependency between non-prime attributes. A non-prime attribute is an attribute that doesn't occur in one of the candidate keys. Then that means that this relation already is 3NF since both A and B, that depend on each other, are part of one of the candidate keys, am I right?
If so, I have another question about BCNF. BCNF says that every determinant must be a candidate key. In this case, A and B are not candidate keys, so that violates BCNF, or am I missing something here?
Thanks.
If the three FDs you have given are supposed to be a canonical cover of the FDs satisfied by R then you are right to conclude that CDA and CDB must be candidate keys. (You didn't state the FDs are canonical and if not then there are other ways to satisfy the same dependencies but I guess the intent of the question is that the candidate keys must be inferred only from what you are given.)
If CDA and CDB are in fact the candidate keys of R then you are right that R satisfies 3NF but not BCNF.
Accoring to Boyce-Codd Normal Form Definition,
Reln R with FDs F is in BCNF if, for all X -> A in F+
-A is subset of X (called a trivial FD), or
-X is a superkey for R.
“R is in BCNF if the only non-trivial FDs over R are key constraints.”
If R in BCNF, then every field of every tuple records information that
cannot be inferred using FDs alone.
What I dont understand is the above two statements about normal form,
Can someone give me an example?
Thanks!
Some Pre-requisite terms before I try to Explain:
• Non-key attribute: An attribute that is not part of any candidate key is known as non-key /non-prime attribute.
• Superkey: A set of attributes within a table whose values can be used to uniquely identify a tuple. A candidate key is a minimal set of attributes necessary to identify a tuple; this is also called a minimal superkey.
Now, BCNF is the advance version of 3NF, stricter than 3NF.
A table is in BCNF if every functional dependency X → Y, X is the super key of the table.
Consider a relation : R(A,B,C,D)
The dependencies are:
A->BCD
BC->AD
D->B
So, Candidate keys(or minimal super keys) are A and BC.
But in dependency: D->B, D is not a superkey.
Hence it violates BCNF form.
We can break this relation into R1 and R2 as:
R1(A,D,C) and R2(D,B) to get BCNF.