The Wayback Machine - https://web.archive.org/web/20241210031410/https://www.geeksforgeeks.org/boyce-codd-normal-form-bcnf/
Open In App

Boyce-Codd Normal Form (BCNF)

Last Updated : 16 Oct, 2024
Summarize
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

Although, 3NF is an adequate normal form for relational databases, this (3NF) normal form may not remove 100% redundancy because of X−>Y functional dependency if X is not a candidate key of the given relation. This can be solved by the Boyce-Codd Normal Form (BCNF). 

Application of the general definitions of 2NF and 3NF may identify additional redundancy caused by dependencies that violate one or more candidate keys. However, despite these additional constraints, dependencies can still exist that will cause redundancy in 3NF relations. This weakness in 3NF resulted in the presentation of a stronger normal form called the Boyce-Codd Normal Form (Codd, 1974).

Boyce-Codd Normal Form (BCNF)

Boyce-Codd Normal Form (BCNF) An advanced version of the third normal form, which is a little more strict. This is a tougher criterion that helps eliminate redundancy and anomalies from your Database. BCNF (Boyce-Codd Normal Form) is a further refinement of the third normal form which simplifies our database design. More precisely, this enforces that every non-trivial functional dependency is determined by superkeys. When is a relation in BCNF: A formula for FD is present, where the left-hand side is super key this solves potential problems with candidate keys as well. Why it enforces no redundancy more strongly than 3NF?

BCNF is essential for good database schema design in higher-level systems where consistency and efficiency are important, particularly when there are many candidate keys (as one often finds with a delivery system).

Rules for BCNF

Rule 1: The table should be in the 3rd Normal Form.

Rule 2: X should be a superkey for every functional dependency (FD) X−>Y in a given relation. 

Note: To test whether a relation is in BCNF, we identify all the determinants and make sure that they are candidate keys.

BCNF in DBMS

BCNF in DBMS

You came across a similar hierarchy known as the Chomsky Normal Form in the Theory of Computation. Now, carefully study the hierarchy above. It can be inferred that every relation in BCNF is also in 3NF. To put it another way, a relation in 3NF need not be in BCNF. Ponder over this statement for a while. 

To determine the highest normal form of a given relation R with functional dependencies, the first step is to check whether the BCNF condition holds. If R is found to be in BCNF, it can be safely deduced that the relation is also in 3NF, 2NF, and 1NF as the hierarchy shows. The 1NF has the least restrictive constraint – it only requires a relation R to have atomic values in each tuple. The 2NF has a slightly more restrictive constraint. 

The 3NF has a more restrictive constraint than the first two normal forms but is less restrictive than the BCNF. In this manner, the restriction increases as we traverse down the hierarchy. 

Examples

Here, we are going to discuss some basic examples which let you understand the properties of BCNF. We will discuss multiple examples here.

Example 1

Let us consider the student database, in which data of the student are mentioned.

Stu_ID Stu_Branch Stu_Course Branch_Number Stu_Course_No
101 Computer Science & Engineering DBMS B_001 201
101 Computer Science & Engineering Computer Networks B_001 202
102 Electronics & Communication Engineering VLSI Technology B_003 401
102 Electronics & Communication Engineering Mobile Communication B_003 402

Functional Dependency of the above is as mentioned:

Stu_ID −> Stu_Branch
Stu_Course −> {Branch_Number, Stu_Course_No}

Candidate Keys of the above table are: {Stu_ID, Stu_Course}

Why this Table is Not in BCNF?

The table present above is not in BCNF, because as we can see that neither Stu_ID nor Stu_Course is a Super Key. As the rules mentioned above clearly tell that for a table to be in BCNF, it must follow the property that for functional dependency X−>Y, X must be in Super Key and here this property fails, that’s why this table is not in BCNF.

How to Satisfy BCNF?

For satisfying this table in BCNF, we have to decompose it into further tables. Here is the full procedure through which we transform this table into BCNF. Let us first divide this main table into two tables Stu_Branch and Stu_Course Table.

Stu_Branch Table

Stu_ID Stu_Branch
101 Computer Science & Engineering
102 Electronics & Communication Engineering

Candidate Key for this table: Stu_ID.

Stu_Course Table

Stu_Course Branch_Number Stu_Course_No
DBMS B_001 201
Computer Networks B_001 202
VLSI Technology B_003 401
Mobile Communication B_003 402

Candidate Key for this table: Stu_Course.

Stu_ID to Stu_Course_No Table

Stu_ID Stu_Course_No
101 201
101 202
102 401
102 402

Candidate Key for this table: {Stu_ID, Stu_Course_No}.

After decomposing into further tables, now it is in BCNF, as it is passing the condition of Super Key, that in functional dependency X−>Y, X is a Super Key.

Example 2

Find the highest normal form of a relation R(A, B, C, D, E) with FD set as:

{ BC->D, AC->BE, B->E } 

Explanation:

  • Step-1: As we can see, (AC)+ ={A, C, B, E, D} but none of its subsets can determine all attributes of the relation, So AC will be the candidate key. A or C can’t be derived from any other attribute of the relation, so there will be only 1 candidate key {AC}.
  • Step-2: Prime attributes are those attributes that are part of candidate key {A, C} in this example and others will be non-prime {B, D, E} in this example.
  • Step-3: The relation R is in 1st normal form as a relational DBMS does not allow multi-valued or composite attributes.

The relation is in 2nd normal form because BC->D is in 2nd normal form (BC is not a proper subset of candidate key AC) and AC->BE is in 2nd normal form (AC is candidate key) and B->E is in 2nd normal form (B is not a proper subset of candidate key AC). 

The relation is not in 3rd normal form because in BC->D (neither BC is a super key nor D is a prime attribute) and in B->E (neither B is a super key nor E is a prime attribute) but to satisfy 3rd normal for, either LHS of an FD should be super key or RHS should be a prime attribute. So the highest normal form of relation will be the 2nd Normal form. 

Note: A prime attribute cannot be transitively dependent on a key in BCNF relation. 

Consider these functional dependencies of some relation R

AB ->C 
C ->B 
AB ->B 

From the above functional dependency, we get that the candidate key of R is AB and AC. A careful observation is required to conclude that the above dependency is a Transitive Dependency as the prime attribute B transitively depends on the key AB through C. Now, the first and the third FD are in BCNF as they both contain the candidate key (or simply KEY) on their left sides. The second dependency, however, is not in BCNF but is definitely in 3NF due to the presence of the prime attribute on the right side. So, the highest normal form of R is 3NF as all three FDs satisfy the necessary conditions to be in 3NF. 

Example 3

For example consider relation R(A, B, C)

A -> BC, 
B -> A

A and B both are super keys so the above relation is in BCNF. 

Note: BCNF decomposition may always not be possible with dependency preserving, however, it always satisfies the lossless join condition. For example, relation R (V, W, X, Y, Z), with functional dependencies:

V, W -> X
Y, Z -> X
W -> Y 

It would not satisfy dependency preserving BCNF decomposition. 

Note: Redundancies are sometimes still present in a BCNF relation as it is not always possible to eliminate them completely.

There are also some higher-order normal forms, like the 4th Normal Form and the 5th Normal Form.

For more, refer to the 4th and 5th Normal Forms.

Conclusion

In conclusion, we can say that Boyce-Codd Normal Form (BCNF) is very much essential as far as database normalization are concerned which help us in doing normalizing beyond the limits of 3NF. By making sure all functional dependencies depend on superkeys, this is how BCNF helps us avoid redundancy and update anomalies. This makes the BCNF a highly desirable property and helps in achieving Data Integrity which is number one concern for any Database Designer.

Boyce-Codd Normal Form (BCNF) – FAQs

How does BCNF differ from 3NF?

BCNF imposes stricter constraints than 3NF by requiring that every determinant in a functional dependency must be a candidate key, while 3NF allows non-prime attributes to be functionally dependent on part of a candidate key under certain conditions.

What are the benefits of applying BCNF?

This will minimize data redundancy, improve data integrity and prevent update anomalies — particularly important for large DB design with multiple candidate keys.

Why is BCNF considered stricter than 3NF?

BCNF is stricter because it eliminates all functional dependencies where the determinant is not a superkey, whereas 3NF allows functional dependencies if the non-prime attribute depends on a candidate key. BCNF ensures that every relation is in a more robust form of normalization, minimizing redundancy and anomalies even further.

When should BCNF be used instead of 3NF?

BCNF is especially useful when your database design involves multiple candidate keys and you want to eliminate redundancy and maintain data consistency more rigorously. If you face update anomalies even after achieving 3NF, BCNF should be applied to resolve those issues.



Next Article

Similar Reads

three90RightbarBannerImg