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. An example of a 3NF table that does not meet BCNF is: • Each row in the table represents a court booking at a tennis club. That club has one hard court (Court 1) and one grass court (Court 2) • A booking is defined by its Court and the period for which the Court is reserved • Additionally, each booking has a Rate Type associated with it. There are four distinct rate types: • SAVER, for Court 1 bookings made by members • STANDARD, for Court 1 bookings made by non-members • PREMIUM-A, for Court 2 bookings made by members • PREMIUM-B, for Court 2 bookings made by non-members The table's
superkeys are: • S1 = {Court, Start time} • S2 = {Court, End time} • S3 = {Rate type, Start time} • S4 = {Rate type, End time} • S5 = {Court, Start time, End time} • S6 = {Rate type, Start time, End time} • S7 = {Court, Rate type, Start time} • S8 = {Court, Rate type, End time} • ST = {Court, Rate type, Start time, End time}, the trivial superkey Note that even though in the above table
Start time and
End time attributes have no duplicate values for each of them, we still have to admit that in some other days two different bookings on court 1 and court 2 could
start at the same time or
end at the same time. This is the reason why {Start time} and {End time} cannot be considered as the table's superkeys. The table's
candidate keys are: • S1 = {Court, Start time} • S2 = {Court, End time} • S3 = {Rate type, Start time} • S4 = {Rate type, End time} Only S1, S2, S3 and S4 are
candidate keys (that is, minimal superkeys for that relation) because e.g. S1 ⊂ S5, so S5 cannot be a candidate key. Given that
2NF prohibits partial functional dependencies of non-prime attributes (i.e., an attribute that does not occur in
any candidate key) and that
3NF prohibits
transitive functional dependencies of non-prime attributes on candidate keys. In the ''Today's court bookings'' table, there are no non-prime attributes: that is, all attributes belong to some candidate key. Therefore, the table adheres to both 2NF and 3NF. The table does not adhere to BCNF. This is because of the dependency Rate type → Court in which the determining attribute is Rate type, on which Court depends. Note that (1) {Rate type} is not a
superkey and (2) {Court} is not a
subset of {Rate type}. Dependency Rate type → Court is respected, since a Rate type should only ever apply to a single Court. The design can be amended so that it meets BCNF: The candidate keys for the Rate types table are {Rate type} and {Court, Member flag}; the candidate keys for the Today's bookings table are {Court, Start time} and {Court, End time}. Both tables are in BCNF. When {Rate type} is a key in the Rate types table, having one Rate type associated with two different Courts is impossible, so by using {Rate type} as a key in the Rate types table, the anomaly affecting the original table has been eliminated. ==Achievability of BCNF==