×

BCNF in DBMS

BCNF stands for Boyce–Codd Normal Form.

What is the Normal form?

The normal form is mainly used to reduce the redundancy of the database tables.

Or we can say that the normal form is a step-by-step process and each step is known as the normal form.

In other words, the normal form is a stage at which we organize the database tables.

There is a different types of normal forms:

  • 1NF( First normal form)
  • 2NF( Second normal form)
  • 3NF( Third normal form)
  • BCNF( Boyce-Codd normal form)

What is Normalization?

Normalization is a process in the database management system that is used to organize the data with its attributes and it also performs data redundancy to check if the data is stored logically or not.

What is BCNF (Boyce-Codd Normal Form)?

BCNF is known as Boyce-Codd Normal Form, it is a special case of 3NF (normal form) and we can also say that it is also known as 3.5 NF. A relation to BCNF (Boyce-Codd normal form) exists if and only if the determinants are candidate key.

Or we can say that BCNF is a normal form in the normalization of databases and its rules are stricter than the 3 NF. It is based on the functional dependencies that take all the determinants of all candidate keys in a relationship.

As we all know, the third normal form doesn’t remove all the redundancy from the database tables in cases where a functional dependency says that B->C, in this case, B is not a candidate key of the database table. BCNF was introduced to deal with such situations.

A table is said to be in form of BCNF if the table is already in the form of the third normal form (3NF) in the DBMS.

And we also know that for every functional dependency, we should have an attribute in the from of candidate keys, let's say (A->B), A is either the super key or the candidate key. In the simple words, for any case, A cannot be a non-prime attribute.

Some Rules for BCNF in DBMS

Suppose, we want to check if the table satisfies the conditions of BCNF, then we need to follow two conditions as follows:

  • First, the table should be in the form of the third normal form (3 NF).
  • For any dependency A→B, in this A must be a super key or a candidate key. In other words, for the function dependency A→ B, if B is a prime attribute of the table, then A cannot be a non-prime attribute of the table.

In the state of 3NF, the transitive dependency must not exist. Transitive dependency is known as the Left-hand side (LHS) of the functional dependency.

It must contain a super key or the candidate key or functional dependency right-hand side (RHS) should be a prime attribute.

Example of BCNF in DBMS

Example 1:

Suppose we have a hospital table where the employees work in more than one department.

EMPLOYEE TABLE

EMP_IDNATIONALITYEMP_DEPTDEPT_TYPEDEPT_NO
E001IndiaSurgeryX12301
E002CanadaDentalX12402
E001IndiaGeneral MedicineX97212
E004PakistanRadiologyX97356

Functional dependencies of this table:

  • EMP_ID → Nationality
  • EMP_DEPT → {DEPT_TYPE, DEPT_NO}

Candidate key of this table:

  • {EMP_ID, EMP_DEPT}

In this example, the table is not BCNF form as both EMP_ID and EMP_DEPT alone are not keys. If we want to convert this table into BCNF form, we need to decompose the table into three tables based on the functional dependency of the table.

NATIONALITY TABLE

EMP_IDNATIONALITY
E001India
E002Canada
E004Pakistan

DEPT TABLE

EMP_DEPTDEPT_TYPEDEPT_NO
SurgeryX12301
DentalX12402
General MedicineX97212
RadiologyX97356

DEPT Mapping table

EMP_IDEMP_DEPT
E001Surgery
E002Dental
E001General Medicine
E004Radiology

Functional dependencies

  • EMP_ID → Nationality
  • EMP_DEPT→ {DEPT_TYPE, DEPT_NO}

Candidate key

  • Nationality Table: EMP_ID
  • DEPT Table: EMP_DEPT
  • DEPT Mapping Table: {EMP_ID, EMP_DEPT}

The relation is now in BCNF form because it satisfies both conditions which are that the table is already in 3NF form and on the LHS of the functional dependency there is a candidate key.

Example: Let's assume we have a company where employees work in more than one department.

EMPLOYEE TABLE

EMP_IDEMP_COUNTRYEMP_DEPTDEPT_TYPEEMP_DEPT_NO
250IndiaITD395183
250IndiaDigital MarketingD395200
362PakistanStoresD284132
362PakistanDevelopingD284449

In the above table, Functional dependencies are as follows:

  • EMP_ID  →  EMP_COUNTRY  
  • EMP_DEPT  →   {DEPT_TYPE, EMP_DEPT_NO}  

Candidate key: {EMP-ID, EMP-DEPT}

The table is not in BCNF because neither EMP_DEPT nor EMP_ID alone are keys.

To convert the given table into BCNF, we decompose it into three tables:

EMP_COUNTRY table:

EMP_IDEMP_COUNTRY
250India
250India

EMP_DEPT table:

EMP_DEPTDEPT_TYPEEMP_DEPT_NO
ITD395183
Digital MarketingD395200
StoresD284132
DevelopingD284449

EMP_DEPT_MAPPING table:

EMP_IDEMP_DEPT
250IT
250Digital Marketing
362Stores
362Developing

Functional dependencies:

  1. EMP_ID   →    EMP_COUNTRY  
  2. EMP_DEPT   →   {DEPT_TYPE, EMP_DEPT_NO}  

Candidate keys:

For the first table: EMP_ID
For the second table: EMP_DEPT
For the third table: {EMP_ID, EMP_DEPT}

Now, this is in BCNF because left side part of both the functional dependencies is a key.


Related Topics

DBMS Data Independence: Logical and Physical

Data Independence in DBMS: Data independence is a concept of DBMS which alters the schema of the database at one level of the database system without altering the schema definition...

2 minutes read.

DBMS Schema

Schema It is a physical representation of data that appears in the database management system. In simple words, a schema is the structure of any database.It defines how the data is stored...

2 minutes read.

ER Diagram of Company Database in DBMS

Entity Relationship Diagram Entity Relationship Diagrams, or ER Diagrams for short, are diagrams that show the relationships among entity sets that are stored in databases. Alternatively said, ER diagrams assist in...

3 minutes read.

Hashing in DBMS: Static and Dynamic

Hashing in DBMS: Hashing is the technique of the database management system, which directly finds the specific data location on the disk without using the concept of index structure. In the...

4 minutes read.

Relational Algebra in DBMS

Relational Algebra is a widely used procedural query language, which takes instances of one or more relation as an input and generates a new relation as an output. It uses a different...

6 minutes read.

B Tree in DBMS

How to perform Insertion operation in B Tree A new value is inserted at the leaf node. Same like in a binary search tree we traverse from starting root node to...

10 minutes read.

Relational Integrity Constraints

Relational Integrity Constraints are the set of rules that can be used to maintain the data integrity during an insert, delete and update operations into a table. These constraints are checked in the...

2 minutes read.

Red-Black Tree Visualization in DBMS

Introduction to Red Black Tree A red-black tree is a self-balanced binary search tree with an extra bit per node, usually read as a color (red or black). The tree is...

4 minutes read.

B-Tree Insertion in DBMS

A B-tree is a special type of m-way tree, commonly used for disk access. A B-tree of order m can have at most m-1 keys and m descendants. B-trees are...

4 minutes read.

Concurrent Execution of Transaction

In the transaction process, a system usually allows executing more than one transaction simultaneously. This process is called a concurrent execution. Advantages of concurrent execution of a transaction Decrease waiting time or...

4 minutes read.

View Serializability in DBMS

View Serializability It is a type of serializability that can be used to check whether the given schedule is view serializable or not. A schedule called as a view serializable if it is view...

4 minutes read.

Enforcing Integrity Constraints in DBMS

Introduction Integrity constraints are rules that specify the conditions that must be met for the data in a database to be considered valid. These constraints help to ensure the accuracy and...

2 minutes read.

Super Key in DBMS

Super Key in DBMS: The super key is a column or a set of columns in the database table, which uniquely identifies the tuple or row of the same table....

2 minutes read.

Multivalued Dependency

Multivalued Dependency exists in a relation when two attributes depend on the third attribute but independent to each other. It is a full constraint between two sets of attributes in a relation. It...

2 minutes read.

DBMS Generalization, Specialization, and Aggregation

DBMS Generalization Generalization is a bottom-up approach in which the common attributes of two or more lower-level entities combines to form a new higher-level entity. In generalization, the generalized entity of higher level can also...

3 minutes read.

Secondary Key in DBMS

What are Keys? Keys in DBMS are the attributes or set of attributes that uniquely identify a row in a set of relations. A table (relation) can have a column or...

3 minutes read.

Advantages of Database Management System in DBMS

A database management system (DBMS) is a software tool that provides an interface for managing data stored in a database. Some advantages of using a DBMS include: data integration, data...

3 minutes read.

Why we need Distributed Database Management System

Assuming there is a very strong single machine having properties like: Heaps of memory.Gigantic measure of dependable stockpiling with very quick I/O.Incredible handling rate and processing power (10s, 100s and might...

4 minutes read.

Domain in DBMS

Constraints: Constraints in DBMS are a set of guidelines that guarantee that authorized users who modify the database do not alter the consistency of the data. Constraints are expressed in DDL...

3 minutes read.

B+ (Plus) Tree in DBMS

What is a B+ tree? The B+ tree is known as a balanced binary search tree. in this tree, we can store the data in the form of nodes. B+ tree...

9 minutes read.