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.
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 a relation R, and a functional dependencies set F ,including only one functional dependency: {X->A}.
prove that if R in 3NF iff R in BCNF.
So far, for the <- direction is trivial by definition. But i struggle to the -> direction. What we know about F-closure? from the definition, i need to check for every functional dependency Y->B that in F-closure, that its trivial or Y is superkey. Is there some conclusions on the superkey of R that i'm missing?
Here is a sketch of the proof.
The fact that a relation schema in BCNF implies that the schema is also in 3NF is due to the definition of 3NF (each determinant is a superkey or implies only prime attributes, and we know that each determinant is a superkeys since the schema is in BCNF).
So we must show that if the relation is in 3NF, then it is also in BCNF.
Now consider the only dependency, {X->A}. For the definition of 3NF, either X is a superkey, or A is prime.
In the first case, if X is a superkey, we know that the schema is also in BCNF.
So, we need to check only the case in which X is not a (super)key, and A is prime.
We can prove that this case is impossible, with the following steps.
We have only two possibilities, either X contains A, or not.
If X contains A then this dependency is trivial, and, since there are no other dependencies, X is a key, and this violates our hypothesis, so we have a contradiction.
If, on the other hand, X is not contained in A, then X is again a key, and this again contradicts our hypothesis.
Finally, note that in this proof I have assumed that there are no other attributes in R a part from XU{A}, otherwise those other attributes should be present in any key of the relation, and there should be at least another dependency with them.
Statement - "If a table contains only one candidate key, the 3NF and the BCNF are equivalent."In the below image, relation is 3nf but not bcnf. But it has only one candidate key ie AB, so according to above statement it should be either both (3nf, bcnf) or nothing. Can somebody explain what i am missing here ?
"If a table contains only one candidate key, the 3NF and the BCNF are equivalent."
The second half, "the 3NF and the BCNF are equivalent", doesn't mean anything. What do you think it means? The normal forms are different things. BCNF requires a more restrictive condition than 3NF. So when a relation is in BCNF it has to also be in 3NF. So a relation can be in both normal forms at the same time.
Presumably the quote is trying to say that, "if a table contains only one candidate key", then if it is in 3NF then it is also in BCNF. And this is correct, because a table that is in 3NF but not in BCNF has to have overlapping CKs (candidate keys). Here the CKs, ie sets of attributes that determine all attrbutes that don't contain a smaller such set, are AB & AC. Which overlap. This table is in 3NF, but it's not in BCNF.
(Note that the FDs that hold are not just ones you are explicitly told hold but all the ones that must hold when they do per Armstrong's axioms.)
In,simple words the given words can be written as
AB->C
AB->D
C->B
In above relations,A,B,C are prime attributes and D is non-prime attributes
Here,AB and AC are minimal Super keys
Condition for 3NF and BCNF
X->Y
For BCNF,X should be Super key whether Y is prime or non-prime attribute
For 3NF,X should be Super key only when Y is non-prime,otherwise it is a optional one
BCNF and 3NF are equivalent when there are no **non-prime** attributes
Hope,it helps.
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.