So, as part of my assignment, I have to prove that any relation with two attributes is in BCNF.

As per my understanding, if for a relation we have 3rd normal form and one non key attribute functionally determine key attribute, it violates the BCNF.

Say my relation consists of two attributes A1,A2

Scenario1(only one functional dependency)

A1 -> A2 (so A1 is the key, and A2 does not FD A1 : so no violation)

same applies for

A2 -> A1

But what if

A1->A2 and A2->A1

Here key can be either A1, A2. And the other non key attribute functionally determines the key.

  • Your conclusion "And the other non key attribute functionally determines the key." is not correct. Because the "other" is a key attribute as wel.. – ypercubeᵀᴹ Oct 31 '15 at 22:48

A relation is in BCNF when, for all FDs that apply to the relation, the left hand side is a superkey. That is, it has to contain all the attributes of at least one key. Your relation must have at least one candidate key (that is, you can't have repeating rows in the relation), else it wouldn't even meet the conditions for 1NF.

Given this, your relation can have zero, one or two FDs. The case for zero FDs is trivial (ab->ab). For one FD (a->b) the left hand side attribute is clearly the key.

In the case where you have FDs in both directions (a->b and b->a) you simply have two different keys, and so the left hand side of each FD remains a superkey.

| improve this answer | |
  • What about the (rather weird) case with these FDs?: ()->AB , A->B, B->A – ypercubeᵀᴹ Nov 1 '15 at 7:26
  • Not sure what you mean by ()->AB as I don't think nothing can ever imply something. Could you give an example? – beldaz Nov 1 '15 at 8:35
  • A relation where the (only) candidate key is the empty set - and can therefore have only 1 or 0 rows. – ypercubeᵀᴹ Nov 1 '15 at 9:07
  • Hmmm. Well if the max number of rows is one then there's no opportunity for redundancy, so I'd say it was automatically BCNF and above. Wouldn't want to have to prove that, though.. – beldaz Nov 1 '15 at 9:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.