0% found this document useful (0 votes)
23 views

11.boyce and Codd Normal Form

11.Boyce and Codd Normal Form

Uploaded by

9047007778
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views

11.boyce and Codd Normal Form

11.Boyce and Codd Normal Form

Uploaded by

9047007778
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Boyce and Codd Normal Form (BCNF)

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:

 R must be in 3rd Normal Form


 and, for each functional dependency ( X → Y ), X should be a super
Key.

Rules for BCNF

For a table to satisfy the Boyce-Codd Normal Form, it should satisfy the
following two conditions:

1. It should be in the Third Normal Form.


2. And, for any dependency A → B, A should be a super key.
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.

Example

Below we have a college enrolment table with


columns student_id, subject and professor.

student_id subject professor

101 Java P.Java

101 C++ P.Cpp

102 Java P.Java2


103 C# P.Chash

104 Java P.Java

As you can see, we have also added some sample data to the table.

In the table above:

 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.

Hence, there is a dependency between subject and 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.


Why this table is not in BCNF?

In the table above, student_id, subject form primary key, which


means subject column is a prime attribute.

But, there is one more dependency, professor → subject.

And while subject is a prime attribute, professor is a non-prime attribute,


which is not allowed by BCNF.

How to satisfy 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.

Student Table

student_id p_id

101 1

101 2

and so on...

And, Professor Table

p_id professor subject

1 P.Java Java

2 P.Cpp C++
and so on...

And now, this relation satisfy Boyce-Codd Normal Form.

You might also like