BeginnersBook

  • Home
  • Java
    • Java OOPs
    • Java Collections
    • Java Examples
  • C
    • C Examples
  • C++
    • C++ Examples
  • DBMS
  • Computer Network
  • Python
    • Python Examples
  • More…
    • jQuery
    • Kotlin
    • WordPress
    • SEO
    • JSON
    • JSP
    • JSTL
    • Servlet
    • MongoDB
    • XML
    • Perl

DBMS 4NF

By Chaitanya Singh | Filed Under: DBMS

A relation is in 4NF if it satisfies the following conditions:

  • It is in BCNF (Boyce Codd Normal Form).
  • It does not have any multi-valued dependency.

What is multi-valued dependency?

Before we learn how to decompose a relation into 4NF, let’s learn what is a multi-valued dependency.

A relation is said to be in multi-valued dependency, if it satisfies the following conditions:

  • For a multi-valued dependency to occur there must be at least 3 columns in the relation, for example R(X, Y, Z).
  • X -> Y (Y is dependant on X), for a single value of X, there are multiple values of Y.
  • If X -> Y exists in a relation R(X, Y, Z) then Y and Z should be independent of each other.

4NF Example

Consider a Table Student that contains the following records:

Stu_IdStu_CourseStu_Hobby
101C++Reading
101C++Writing

A student can join more than one courses, let’s say Ram joins another course “Java”.

The issue: For a new course, instead of one row, two rows need to be added.

Stu_IdStu_CourseStu_Hobby
101C++Reading
101C++Writing
101JavaReading
101JavaWriting

This relation has multi-valued dependency as

  • Stu_Id -> Stu_Course, Student course is dependent on Student Id and for each student id, there are multiple courses.
  • Also, Stu_Course and Stu_Hobby are independent of each other.
  • And relation has at least three columns.

This table has unnecessary records as for each new course, more than one records needs to be added to the table. Also, we have concluded that the table has multi-valued dependency.

Let’s decompose this table in 4NF:

This table is already in BCNF. We just need to remove the multi-valued dependency. Let’s decompose the original table into two tables.

Table 1: Course

Stu_IdStu_Course
101C++
101Java

Table 2: Hobby

Stu_IdSu_Hobby
101Reading
101Writing

These tables are in 4NF as the multi-valued dependency is removed. Now, let’s say you want to add another course “Python” to student id 101, you just need to add one record in the Course table. Similarly if you want to add a new hobby “Travelling”, you can just add a single record to the Hobby table.

DBMS Tutorial

Basics

  • DBMS Tutorial
  • DBMS Introduction
  • Database Applications
  • DBMS vs File System
  • DBMS vs RDBMS
  • DBMS Architecture
  • Three-level DBMS architecture
  • View in DBMS
  • Abstraction
  • Instance & Schema
  • DBMS languages

Data Models

  • Data Models
  • ER Diagram
  • ER Design issues
  • Convert ER to table
  • DBMS Generalization
  • DBMS Specialization
  • DBMS Aggregration
  • Relational Model
  • Hierarchical Model
  • Constraints
  • Cardinality

Relational Database

  • RDBMS concepts
  • Relational Algebra
  • Relational Calculus
  • Keys Index
  • Primary Key
  • Super Key
  • Candidate Key
  • Foreign Key
  • Composite Key
  • Alternate Key

Normalization

  • Normalization
  • Functional dependency

Transaction Management

  • Transaction Management
  • ACID properties
  • Transaction States
  • DBMS Schedules
  • Serializability
  • Conflict Serializability
  • View Serializability
  • Recoverability Of Schedule
  • Failure Classification
  • Log based Recovery
  • DBMS Checkpoint
  • Deadlock

Concurrency Control

  • Concurrency Control
  • Lock based protocol
  • Timestamp based protocol
  • Validation based protocol

File Organization

  • File Organization
  • Sequential File Organization
  • Heap File Organization
  • Hash File Organization
  • DBMS ISAM
  • B+ File Organization
  • Cluster File Organization

SQL Introduction

  • SQL Introduction
  • SQL Characteristics
  • Advantages of SQL
  • SQL Commands
  • SQL Operators
  • SQL CREATE
  • SQL DROP
  • SQL SELECT
  • SQL INSERT

Copyright © 2012 – 2022 BeginnersBook . Privacy Policy . Sitemap