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 – Second Normal Form (2NF)

Last Updated: May 5, 2022 by Chaitanya Singh | Filed Under: DBMS

A relation is said to be in 2NF if it satisfy both the following conditions:

  • Relation must be in 1NF (First normal form)
  • No non-prime attribute is dependent on the proper subset of any candidate key of table.

An attribute that is not part of any candidate key is known as non-prime attribute.

Example: Let’s say a School store the teachers data in TEACHER table, which looks like this:

TEACHER_IDSUBJECTTEACHER_AGE
I101MATHS45
I101PHYSICS45
I102MATHS45
I103PHYSICS42
I103ENGLISH42

Here we have multiple teachers with same TEACHER_AGE also there are different teachers who teach the same subject.

Here using TEACHER_AGE alone, we cannot determine the value of SUBJECT or TEACHER_ID.

TEACHER_AGE together with SUBJECT cannot determine the value of TEACHER_ID as there are multiple different teachers with same TEACHER_AGE and SUBJECT.

TEACHER_AGE together with TEACHER_ID cannot determine the value of SUBJECT as same teacher teaches multiple subjects.

Hence the table has only one candidate key which is {TEACHER_ID, SUBJECT}, also the attribute TEACHER_AGE is a non-prime attribute as it doesn’t belong to the candidate key.

But, TEACHER_ID -> TEACHER_AGE, i.e., TEACHER_AGE is dependent on TEACHER_ID, which is a proper subset of the candidate key. Non-prime attribute TEACHER_AGE is dependent on a proper subset of the candidate key, which is a partial dependency and so this relation is not in 2NF.

To convert the above relation to 2NF, we need to split the table into two tables such as :
Table 1: TEACHER_ID, TEACHER_AGE
Table 2: TEACHER_ID, SUBJECT

Table 1:
TEACHER_ID      TEACHER_AGE
I101            45
I102            45
I103            42

Table 2:
TEACHER_ID      SUBJECT
I101            MATHS
I101            PHYSICS
I102            MATHS
I103            PHYSICS
I103            ENGLISH

Now these relations are in 2NF. Second normal form helped us to reduce the redundancy in the original table. If multiple teaches are teaching multiple subjects, we need not to create multiple rows with the same data.

❮ 1NFDBMS Normalization ❯

Top Related Articles:

  1. Deadlock in DBMS
  2. Instance and schema in DBMS
  3. Primary key in DBMS
  4. DBMS – Recursive Relationship in ER Diagrams
  5. Alternate key in DBMS

About the Author

I have 15 years of experience in the IT industry, working with renowned multinational corporations. Additionally, I have dedicated over a decade to teaching, allowing me to refine my skills in delivering information in a simple and easily understandable manner.

– Chaitanya

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

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 – 2025 BeginnersBook . Privacy Policy . Sitemap