Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Finding a relation in 3NF but not in BCNF

I've been reading many different sources on how to differentiate relations that are in 3NF/BCNF. And I've so far this is my understanding...

I will use this relation as an example...

R = {A, B, C, D, E}

and

F = {A -> B, B C - > E, E D -> A}.

Firstly we must find the keys of the relation. I used this video to help me do that. And I got

Keys = {ACD, BCD, CDE}

Now to make sure R is in BCNF, we must make sure that the left hand side of every functional dependency in F is one of the Keys. We instantly know this is not the case, because the first FD is A -> B and A is not one of the keys. So it is not in BCNF.

Now to make sure R is in 3NF, we must make sure that the left hand side of every functional dependency in F is one of the Keys OR the right hand side of every functional dependency in F is a subset of one of the Keys. If you look at the right hand side of every FD, they are B, E and A. These are each a subset of a Key, so this means that it is in 3NF.

So this is one of the rare cases (according to wiki) where a relation is in 3NF but not in BCNF. Is this method correct? Is it reliable? Am I missing anything?

like image 481
Ogen Avatar asked May 15 '14 14:05

Ogen


People also ask

When a relation would be in 3NF but not in BCNF?

Every relation in BCNF is also in 3NF, but the reverse is not necessarily true. 3NF allows attributes to be part of a candidate key that is not the primary key; BCNF does not. This means that relations in 3NF are often in BCNF, but not always.

What is the relationship between BCNF and 3NF?

BCNF is an extension of 3NF and it is has more strict rules than 3NF. Also, it is considered to be more stronger than 3NF. This relation is in BCNF as it is already in 3Nf (there is no prime attribute deriving no prime attribute) and on the left hand side of the functional dependency there is a candidate key.

Is it required for a table to be in 3NF to be in BCNF?

Only in rare cases does a 3NF table not meet the requirements of BCNF. A 3NF table that does not have multiple overlapping candidate keys is guaranteed to be in BCNF. Depending on what its functional dependencies are, a 3NF table with two or more overlapping candidate keys may or may not be in BCNF.

How do you find a relation is BCNF or not?

A relation is in BCNF iff, X is superkey for every functional dependency (FD) X? Y in given relation. In other words, A relation is in BCNF, if and only if, every determinant is a Form (BCNF) candidate key.


2 Answers

First you need to learn superkeys, candidate keys, and primary attributes.

However, this rule of thumb helps:

A 3NF table that does not have multiple overlapping candidate keys is guaranteed to be in BCNF.

In other words, if the candidate keys in a 3NF relation are

  • all atomic, or
  • non-atomic but non-overlapping,

it is guaranteed that the relation is in BCNF.

The simplest relation which violates BCNF but meets 3NF has the following functional dependencies:

A,B -> C C -> B

In this case, candidate keys are (A,B) and (A,C).
It meets 3NF because

  • the right-hand-side of all functional dependencies is a primary attribute.

It violates BCNF because

  • C -> B, but the left-hand-side is not a superkey.
like image 101
Amir Avatar answered Oct 13 '22 18:10

Amir


BCNF:

X->Y where Y can be prime or non-prime
Here,X must be a super key

3NF:

X->Y where Y is non-prime
then,
X must be a super key
else
X need not be super key

Hope,this helps

like image 36
Lordferrous Avatar answered Oct 13 '22 16:10

Lordferrous