Boyce-Codd Normal Form or BCNF is an extension to the third normal form, and is also known as 3.5 Normal Form.
Before you continue with Boyce-Codd Normal Form, check these topics for better understanding of database normalization concept:
Follow the video above for complete explanation of BCNF. Or, if you want, you can even skip the video and jump to the section below for the complete tutorial.
In our last tutorial, we learned about the third normal form and we also learned how to remove transitive dependency from a table, we suggest you to follow the last tutorial before this one.
For a table to satisfy the Boyce-Codd Normal Form, it should satisfy the following two conditions:
The second point sounds a bit tricky, right? In simple words, it means, that for a dependency A → B, A cannot be a non-prime attribute, if B is a prime attribute.
Below we have a college enrolment table with columns
As you can see, we have also added some sample data to the table.
In the table above:
What do you think should be the Primary Key?
Well, in the table above
student_id, subject together form the primary key, because using
subject, we can find all the columns of the table.
One more important point to note here is, one professor teaches only one subject, but one subject may have two different professors.
Hence, there is a dependency between
professor here, where
subject depends on the professor name.
This table satisfies the 1st Normal form because all the values are atomic, column names are unique and all the values stored in a particular column are of same domain.
This table also satisfies the 2nd Normal Form as their is no Partial Dependency.
And, there is no Transitive Dependency, hence the table also satisfies the 3rd Normal Form.
But this table is not in Boyce-Codd Normal Form.
In the table above,
student_id, subject form primary key, which means
subject column is a prime attribute.
But, there is one more dependency,
subject is a prime attribute,
professor is a non-prime attribute, which is not allowed by BCNF.
To make this relation(table) satisfy BCNF, we will decompose this table into two tables, student table and professor table.
Below we have the structure for both the tables.
|and so on...|
And, Professor Table
|and so on...|
And now, this relation satisfy Boyce-Codd Normal Form. In the next tutorial we will learn about the Fourth Normal Form.
In the picture below, we have tried to explain BCNF in terms of relations.