When will it be in 3NF?

710 Views Asked by At

I am having a hard time understanding the 3 Normal form.

3 NF: 2 NF + No transitions

So, for eg: If I have,

A -> B
B -> C

Then the above is sort of a transition relation and hence won't be in 3 NF? Am I understanding it correctly?

But in this answer What exactly does database normalization do? , by paxdiablo, it says,

Third normal form (3NF) - 2NF and every non-key column in a table depends on nothing but the key.According to this, it will be in 3 NF. Where am I going wrong?

2

There are 2 best solutions below

19
Renzo On BEST ANSWER

A relation is in 3NF if it is in 2NF and:

  1. either each attribute depends on a key,
  2. or, if an attribute depends on a non-key, then it is prime.

(being prime means that it belongs to a key).

See for instance Wikipedia.

A relation is in Boyce-Codd normal form if only the first condition hold, that is:

  1. each attribute depends on a key

So, in your example, if the relation has only three attributes A, B and C and the two dependencies, it is not in 3NF, since C is not prime, and depends on B, which is a not a key. On the other hand, if there are other attributes, and C is a key or part of a key, then it could be in 3NF (but this depends on the other functional dependencies, that should satisfy the above conditions).

The 2NF says that each non-prime attribute depends on each whole candidate key, and not by part of it. For instance, if a relation has attributes A, B and C, the only key is AB, and B -> C, then this relation is not in 2NF.

0
philipxy On

The 2-part 3nf definition you are trying for is:

  • 2NF holds and every non-prime attribute of R is non-transitively dependent on every superkey. (X transitively determines Z when there's a Y where X → Y and Y → Z and not Y → X.)

The other definition of 3NF is:

  • For every non-trivial FD X → Y, either X is a superkey or the attributes in Y but not in X are prime. (X → Y is trivial when X contains Y.)

Then BCNF is:

  • For every non-trivial FD X → Y, X is a superkey

See this answer.

If your example's only columns are A, B and C and your two FDs form a minimal cover then the only candidate key is A and C is dependent on a non-superkey so it is not in 3NF (or BCNF).

You are (mis)using terms so sloppily that your sentences don't mean anything. Learn the terms and how they are used in their definitions to refer to various things and use them that way in reference to appropriate things. And get your definitions from a (reputable) textbook.