# Is this table in third normal form?

I have a table L(A, B, C). Functional dependencies are: A->B, A->C, B->A, B->C. Is this table in 3nf? My thoughts: A and B are keys of this table. Table is in 3nf if there are no transitive dependencies between keys and non-prime attributes. There is a transitive dependence A->B->C, so it's not in 3nf? Or it does not work in this way, because B is a key? Hopefully I didn't confuse you too much. Thanks.

• First check: is it in 2NF? – ypercubeᵀᴹ Jun 9 '14 at 19:03
• Since there are no multi-part keys it must be in 2nf, right? – user1242967 Jun 9 '14 at 19:07
• Oh yes, sorry, it is in 2NF. And in 3NF as well. – ypercubeᵀᴹ Jun 9 '14 at 19:09
• Could you explain why? From A->B and B->C we get A->C, this is transitive dependence, right? If it is, then it's not in 3nf, but my intuition says that it is in 3nf and I am somehow misunderstanding this transitivity thing. – user1242967 Jun 9 '14 at 19:15
• It wouldn't be in 3NF if `B` wasn't a candidate key itself. But it is. – ypercubeᵀᴹ Jun 9 '14 at 19:27

Here's one attempt (this is not a day to day activity for me, so I may be doing some weird errors below):

A and B are clearly candidate keys of R. Therefore C is the only non-prime attribute of R

R is in 3NF iff:

a) R is in 2NF

b) Every non-prime attribute of R (C) is non-transitively dependent on every superkey of R.

The superkeys of R is (A, B), (A, C), (A, B, C)

By reflexivity (A, C) -> C AND (A, B, C) -> C By composition of A->C and B->C we get (A, B) -> (C, C), i.e. (A, B) -> C

C is therefore non-transitively dependent on every superkey of R, and hence R is in 3NF.

• R is in 2NF since it has no composite candidate keys, i.e. C (non-prime) can not be dependent on part of a c.k. – Lennart Jun 9 '14 at 21:31

Here's a condition that will help you in the future to check if a relation is in 3NF (it checks 2NF implicitly, i.e can be applied on any relation directly without checking 2NF) :

A relation is in 3NF if for every non-trivial functional dependency(X is not a superset of Y in X->Y) the following 2 conditions hold

1) Either X is a superkey

2) or Y is a prime attribute.

Here, taking your question as an example. R(A,B,C) FDs : A->BC, B->AC

For both the F.D the left hand side A and B are both superkeys (c.k in this case). So, its in 3NF (and hence, 2NF)