Search code examples
databasedatabase-designdatabase-normalizationfunctional-dependenciesbcnf

Is this allowed in BCNF Normalization?


I know that in BCNF if A->B then A must be a candidate key. But what about if A is part of the candidate key but not the whole candidate key?

Let me explain in an example:

Exercise 1:

Candidate keys: {A},{B,C}

Functional dependencies: B->D

Relation: R(B,D)

Is R BCNF as B is part of the candidate key or to be BCNF R should be = (B,C,D)? Also, I guess that if R was = (A,B,D) it is not BCNF and the only way to let R be BCNF should be R = (A,D) or R = (B,C,D) Is that right?

Exercise 2: What would change if now we have the same R as exercise 1 but now we also know that B is primary key?

Candidate keys: {A},{B,C}

Functional dependencies: B->D

Relation: R(B(PK),D) as B is primary key now, if x is primary key it is also candidate key, right? So R in this case is BCNF.

Is everything I said okay?


Solution

  • Look into Second Normal Form. If a relation is not in 2NF, it is therefore not in BCNF. If a deteminant is a subset of a candidate key, and if the determined value is non key, the relation is not in 2NF. And the dermined value cannot be part of the key, becuase a subset of the candidate key would then be a candidate key.