11.boyce and Codd Normal Form
11.boyce and Codd Normal Form
Boyce and Codd Normal Form is a higher version of the Third Normal
form. This form deals with certain type of anomaly that is not handled by
3NF. A 3NF table which does not have multiple overlapping candidate
keys is said to be in BCNF. For a table to be in BCNF, following conditions
must be satisfied:
For a table to satisfy the Boyce-Codd Normal Form, it should satisfy the
following two conditions:
Example
As you can see, we have also added some sample data to the table.
One student can enrol for multiple subjects. For example, student
with student_id 101, has opted for subjects - Java & C++
For each subject, a professor is assigned to the student.
And, there can be multiple professors teaching one subject like we
have for Java.
What do you think should be the Primary Key?
Well, in the table above student_id, subject together form the primary key,
because using student_id and 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.
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.
Student Table
student_id p_id
101 1
101 2
and so on...
1 P.Java Java
2 P.Cpp C++
and so on...