BCNF and 3NF property - database

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.

Related

Condition when BCNF and 3NF are equivalent

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.

Does this qualify as a partial dependency?

Proper subset of candidate key along with non prime attribute determines non prime. Then is it partial dependency or in 2NF?
CAND KEY {AB} then BD-->C .
This is how you define a partial dependency: For example you have a relation R with columns A|B|C|D.
Based on the functional dependency defined by business AB is designated as primary key (candidate key) and B -> D FD exists.
In that case, even though AB is PK; but non key column D is uniquely identified by only B (part of the key composition) and not by the entire key composition AB.
So, D here is partially dependent on key column and thus hold a partial functional dependency which is against 2NF.
In your case, CK AB is not uniquely identifying all fields; C is partially dependent on B; moreover, C is dependent on non-key column D.
So, it has PFD (partial functional dependency) and surely not in 2NF.

Normalization 3NF and BCNF

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.

Boyce-Codd Normal Form explain

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.

Dividing relations to achieve BCNF

Is the relation from below correctly divided into relations in BCNF:
R(a,b,c,d,e) - a and b are primary keys and there are dependencies such as:
a → c
a → e
c → e
I split the above relations into:
AC(a,c)
CE(c,e)
AB(a,b,d)
Is it the case that a is a primary key and b is a primary key, or is it the case that {a,b} is the (composite) primary key? If the columns are separately primary keys, then you have a number of additional but not explicitly stated functional dependencies: a → bd and b → acde. If the columns {a,b} are a composite PK, then you have an additional functional dependency ab → cde. Either way, the AC and CE relations are fine, and the ABD relation is the other necessary one. The only issue is 'what are the candidate keys of ABD'? And the answer is 'either {a,b} as a composite PK, or a and b as two separate candidate keys'.
Are you sure about that primary key? Normally, determining all the candidate keys is part of these kinds of exercises.
An informal way of expressing what we know about candidate keys is that every attribute that's not on the right-hand side (RHS) of any functional dependency must be part of every candidate key.
Since I don't know how you determined that {ab} is a candidate key, I'd be inclined to say that, because {abd} is not on any RHS, {abd} must be part of every candidate key.
In short, your FDs say that {abd} is the primary key, not {ab}.
In order for your key and your decomposition to be right, you need to have the additional FD ab->d.

Resources