HOME

TheInfoList



OR:

Boyce–Codd normal form (BCNF or 3.5NF) is a normal form used in
database normalization Database normalization is the process of structuring a relational database in accordance with a series of so-called '' normal forms'' in order to reduce data redundancy and improve data integrity. It was first proposed by British computer scien ...
. It is a slightly stricter version of the
third normal form Third normal form (3NF) is a database schema design approach for relational databases which uses normalizing principles to reduce the duplication of data, avoid data anomalies, ensure referential integrity, and simplify data management. It was d ...
(3NF). By using BCNF, a database will remove all redundancies based on functional dependencies.


History

Edgar F. Codd released his original article "A Relational Model of Data for Large Shared Databanks" in June 1970. This was the first time the notion of a relational database was published. All work after this, including the Boyce–Codd normal form method was based on this relational model. The Boyce–Codd normal form was first described by Ian Heath in 1971, and has also been called Heath normal form by Chris Date. BCNF was formally developed in 1974 by Raymond F. Boyce and
Edgar F. Codd Edgar Frank "Ted" Codd (19 August 1923 – 18 April 2003) was a British computer scientist who, while working for IBM, invented the relational model for database management, the theoretical basis for relational databases and relational database ...
to address certain types of anomalies not dealt with by 3NF as originally defined.Codd, E. F. "Recent Investigations into Relational Data Base" in ''Proc. 1974 Congress'' (Stockholm, Sweden, 1974). New York, N.Y.: North-Holland (1974). As mentioned, Chris Date has pointed out that a definition of what we now know as BCNF appeared in a paper by Ian Heath in 1971.Heath, I. "Unacceptable File Operations in a Relational Database". ''Proc. 1971 ACM SIGFIDET Workshop on Data Description, Access, and Control'', San Diego, Calif. (November 11th–12th, 1971). Date writes:Date, C. J. ''Database in Depth: Relational Theory for Practitioners''. O'Reilly (2005), p. 142.
Since that definition predated Boyce and Codd's own definition by some three years, it seems to me that BCNF ought by rights to be called ''Heath'' normal form. But it isn't.


Definition

If a relational schema is in BCNF, then all redundancy based on functional dependency has been removed, although other types of redundancy may still exist. A relational schema ''R'' is in Boyce–Codd normal form
if and only if In logic and related fields such as mathematics and philosophy, "if and only if" (often shortened as "iff") is paraphrased by the biconditional, a logical connective between statements. The biconditional is true in two cases, where either bo ...
for every one of its functional dependencies ''X → Y'', at least one of the following conditions hold: * ''X'' → ''Y'' is a trivial functional dependency (Y ⊆ X), * ''X'' is a superkey for schema ''R''. If a relational schema is in BCNF, then it is automatically also in 3NF because BCNF is a stricter form of 3NF. While all BCNF relations satisfy the conditions for 3NF, not all 3NF relations satisfy the stricter requirements of BCNF, which eliminates all redundancy caused by functional dependencies.


Relation with 3NF tables

Only in rare cases does a 3NF table not meet the requirements of BCNF. A 3NF table that does not have multiple overlapping
candidate key A candidate key, or simply a key, of a relational database is any set of columns that have a unique combination of values in each row, with the additional constraint that removing any column could produce duplicate combinations of values. A candi ...
s is guaranteed to be in BCNF.Vincent, M. W. and B. Srinivasan. "A Note on Relational Schemes Which Are in 3NF But Not in BCNF". ''Information Processing Letters'' 48(6), 1993, pp. 281–283. 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 = * S2 = * S3 = * S4 = * S5 = * S6 = * S7 = * S8 = * ST = , 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 and cannot be considered as the table's superkeys. The table's
candidate key A candidate key, or simply a key, of a relational database is any set of columns that have a unique combination of values in each row, with the additional constraint that removing any column could produce duplicate combinations of values. A candi ...
s are: * S1 = * S2 = * S3 = * S4 = Only S1, S2, S3 and S4 are
candidate key A candidate key, or simply a key, of a relational database is any set of columns that have a unique combination of values in each row, with the additional constraint that removing any column could produce duplicate combinations of values. A candi ...
s (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 A candidate key, or simply a key, of a relational database is any set of columns that have a unique combination of values in each row, with the additional constraint that removing any column could produce duplicate combinations of values. A candi ...
) 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) is not a superkey and (2) is not a
subset In mathematics, a Set (mathematics), set ''A'' is a subset of a set ''B'' if all Element (mathematics), elements of ''A'' are also elements of ''B''; ''B'' is then a superset of ''A''. It is possible for ''A'' and ''B'' to be equal; if they a ...
of . 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 and ; the candidate keys for the Today's bookings table are and . Both tables are in BCNF. When is a key in the Rate types table, having one Rate type associated with two different Courts is impossible, so by using as a key in the Rate types table, the anomaly affecting the original table has been eliminated.


Achievability of BCNF

In some cases, a non-BCNF table cannot be decomposed into tables that satisfy BCNF and preserve the dependencies that held in the original table. Beeri and Bernstein showed in 1979 that, for example, a set of functional dependencies cannot be represented by a BCNF schema.Beeri, Catriel and Bernstein, Philip A. "Computational problems related to the design of normal form relational schemas". ''ACM Transactions on Database Systems'' 4(1), March 1979, p. 50. Consider the following non-BCNF table whose functional dependencies follow the pattern: For each Person / Shop type combination, the table tells us which shop of this type is geographically nearest to the person's home. We assume for simplicity that a single shop cannot be of more than one type. The candidate keys of the table are: * , * . Because all three attributes are prime attributes (i.e. belong to candidate keys), the table is in 3NF. The table is not in BCNF, however, as the Shop type attribute is functionally dependent on a non-superkey: Nearest shop. The violation of BCNF means that the table is subject to anomalies. For example, Eagle Eye might have its Shop type changed to "Optometrist" on its "Fuller" record while retaining the Shop type "Optician" on its "Davidson" record. This would imply contradictory answers to the question: "What is Eagle Eye's Shop Type?" Holding each shop's Shop type only once would seem preferable, as doing so would prevent such anomalies from occurring: In this revised design, the "Shop near person" table has a candidate key of , and the "Shop" table has a candidate key of . Unfortunately, although this design adheres to BCNF, it is unacceptable on different grounds: it allows us to record multiple shops of the same type against the same person. In other words, its candidate keys do not guarantee that the functional dependency → will be respected. A design that eliminates all of these anomalies (but does not conform to BCNF) is possible. This design introduces a new normal form, known as Elementary Key Normal Form.Zaniolo, Carlo. "A New Normal Form for the Design of Relational Database Schemata". ''ACM Transactions on Database Systems'' 7(3), September 1982, p. 493. This design consists of the original "Nearest shops" table supplemented by the "Shop" table described above. The table structure generated by Bernstein's schema generation algorithmBernstein, P. A. "Synthesizing Third Normal Form relations from functional dependencies". ''ACM Transactions on Database Systems'' 1(4), December 1976 pp. 277–298. is actually EKNF, although that enhancement to 3NF had not been recognized at the time the algorithm was designed: If a referential integrity constraint is defined to the effect that from the first table must refer to a from the second table, then the data anomalies described previously are prevented.


Intractability

It is
NP-complete In computational complexity theory, NP-complete problems are the hardest of the problems to which ''solutions'' can be verified ''quickly''. Somewhat more precisely, a problem is NP-complete when: # It is a decision problem, meaning that for any ...
, given a database schema in
third normal form Third normal form (3NF) is a database schema design approach for relational databases which uses normalizing principles to reduce the duplication of data, avoid data anomalies, ensure referential integrity, and simplify data management. It was d ...
, to determine whether it violates Boyce–Codd normal form.


Decomposition into BCNF

If a relation R is not in BCNF due to a functional dependency X→Y, then R can be decomposed into BCNF by replacing that relation with two sub-relations: # One with the attributes X+, # and another with the attributes R-X++X. Note that R represents all the attributes in the original relation. Check whether both sub-relations are in BCNF and repeat the process recursively with any sub-relation which is not in BCNF.


References


Bibliography

* Date, C. J. (1999). ''An Introduction to Database Systems'' (8th ed.). Addison-Wesley Longman. .


External links


Rules Of Data Normalization


by ITS, University of Texas. {{DEFAULTSORT:Boyce-Codd normal form BCNF NP-complete problems de:Normalisierung (Datenbank)#Boyce-Codd-Normalform (BCNF)