DBMS Concepts

DBMS Tutorial Components of DBMS. Applications of DBMS The difference between file system and DBMS. Types of DBMS DBMS Architecture DBMS Schema Three Schema Architecture. DBMS Languages.

DBMS ER Model

ER model: Entity Relationship Diagram (ERD) Components of ER Model. DBMS Generalization, Specialization and Aggregation.

DBMS Relational Model

Codd’s rule of DBMS Relational DBMS concepts Relational Integrity Constraints DBMS keys Convert ER model into Relational model Difference between DBMS and RDBMS Relational Algebra DBMS Joins

DBMS Normalization

Functional Dependency Inference Rules Multivalued Dependency Normalization in DBMS: 1NF, 2NF, 3NF, BCNF and 4NF

DBMS Transaction

What is Transaction? States of transaction ACID Properties in DBMS Concurrent execution and its problems DBMS schedule DBMS Serializability Conflict Serializability View Serializability Deadlock in DBMS Concurrency control Protocols

Difference

Difference between DFD and ERD

Misc

Advantages of DBMS Disadvantages of DBMS Data Models in DBMS Relational Algebra in DBMS Cardinality in DBMS Entity in DBMS Attributes in DBMS Data Independence in DBMS Primary Key in DBMS Foreign Key in DBMS Candidate Key in DBMS Super Key in DBMS Aggregation in DBMS Hashing in DBMS Generalization in DBMS Specialization in DBMS View in DBMS File Organization in DBMS What Is A Cloud Database What Is A Database Levels Of Locking In DBMS What is RDBMS Fragmentation in Distributed DBMS What is Advanced Database Management System Data Abstraction in DBMS Checkpoint In DBMS B Tree in DBMS BCNF in DBMS Advantages of Threaded Binary Tree in DBMS Advantages of Database Management System in DBMS Enforcing Integrity Constraints in DBMS B-Tree Insertion in DBMS B+ Tree in DBMS Advantages of B-Tree in DBMS Types of Data Abstraction in DBMS Levels of Abstraction in DBMS 3- Tier Architecture in DBMS Anomalies in Database Management System Atomicity in Database Management System Characteristics of DBMS DBMS Examples Difference between Relational and Non-Relational Databases Domain Constraints in DBMS Entity and Entity set in DBMS ER Diagram for Banking System in DBMS ER Diagram for Company Database in DBMS ER Diagram for School Management System in DBMS ER Diagram for Student Management System in DBMS ER Diagram for University Database in DBMS ER Diagram of Company Database in DBMS Er Diagram Symbols and Notations in DBMS How to draw ER-Diagram in DBMS Integrity Constraints in DBMS Red-Black Tree Deletion in DBMS Red-Black Tree Properties in DBMS Red-Black Tree Visualization in DBMS Redundancy in Database Management System Secondary Key in DBMS Structure of DBMS 2-Tier Architecture in DBMS Advantages and Disadvantages of Binary Search Tree Closure of Functional Dependency in DBMS Consistency in Database Management System Durability in Database Management System ER Diagram for Bank Management System in DBMS ER Diagram for College Management System in DBMS ER Diagram for Hotel Management System in DBMS ER Diagram for Online Shopping ER Diagram for Railway Reservation System ER Diagram for Student Management System in DBMS Isolation in DBMS Lossless Join and Dependency Preserving Decomposition in DBMS Non-Key Attributes in DBMS Data Security Requirements in DBMS DBMS functions and Components What is Homogeneous Database? DBMS Functions and Components Advantages and Disadvantages of Distributed Database Relational Database Schema in DBMS Relational Schema Transaction Processing in DBMS Discriminator in DBMS

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.