TheHingineer

  • DBMS


  • DBMS Part-1

  • DBMS Part-2

  • DBMS Part-3

  • DBMS Part-4

  • DBMS Part-5

  •  Normalization in DBMS 

    Normalization ek process hai jisme hum database ko design karte waqt usme se redundancy (data ka repetition) aur inconsistency (confusing ya galat data) hataate hain.

    Normalization step-by-step hota hai using Normal Forms – jaise 1NF, 2NF, 3NF, BCNF, 4NF, and 5NF.


     1NF (First Normal Form)

    Condition: Table ka har column atomic hona chahiye.
    Matlab, har cell mein sirf ek value ho – na ki list ya group.

    Example:

    StudentID Name Courses
    101 Rahul Math, Science
    102 Priya English

     Yeh table 1NF nahi hai kyunki “Courses” column mein multiple values hain.

     1NF version:

    StudentID Name Course
    101 Rahul Math
    101 Rahul Science
    102 Priya English

     2NF (Second Normal Form)

    Condition:

    1. Table 1NF mein hona chahiye

    2. Har non-key column fully dependent hona chahiye entire primary key par, na ki uske part par.

    Example (1NF but not 2NF):

    Composite key: (StudentID, Course)
    StudentID Course StudentName
    101 Math Rahul
    101 Science Rahul

    Yahan StudentName sirf StudentID pe depend hai, na ki (StudentID + Course) ke combination par. Isiliye 2NF nahi hai.

     2NF version:

    Student Table:

    StudentID StudentName
    101 Rahul

    Course Table:

    StudentID Course
    101 Math
    101 Science

     3NF (Third Normal Form)

    Condition:

    1. Table 2NF mein hona chahiye

    2. Non-key columns sirf primary key pe dependent hone chahiye, doosre non-key column pe nahi.

    Example (2NF but not 3NF):

    StudentID StudentName Department HOD
    101 Rahul CS Dr. Meena

    Yahan HOD dependent hai Department pe, not directly on StudentID → violation of 3NF.

     3NF version:

    Student Table:

    StudentID StudentName Department
    101 Rahul CS

    Department Table:

    Department HOD
    CS Dr. Meena

     BCNF (Boyce-Codd Normal Form)

    Condition:
    Table 3NF mein ho + har determinant super key hona chahiye.

    Determinant: Jo kisi column ki value decide karta hai.

    Example:

    Course Teacher Room
    Math Mr. A 101
    Science Mr. B 102

    Assume ek teacher ek hi course padhata hai, lekin teacher bhi room decide karta hai.

    Yahan Teacher → Course and Teacher → Room, but Teacher primary key nahi hai. Isiliye BCNF violated.

     Split into BCNF:

    Teacher_Course Table:

    Teacher Course
    Mr. A Math

    Teacher_Room Table:

    Teacher Room
    Mr. A 101

     4NF (Fourth Normal Form)

    Condition:
    No multi-valued dependency if table already in BCNF.

    Multi-valued Dependency Example:

    Student Course Hobby
    Rahul Math Cricket
    Rahul Science Cricket
    Rahul Math Singing

    Yahan Rahul ke paas do courses aur do hobbies hain → toh combinations ban rahe hain unnecessarily.

     4NF version:

    Student_Course Table:

    Student Course
    Rahul Math
    Rahul Science

    Student_Hobby Table:

    Student Hobby
    Rahul Cricket
    Rahul Singing

     5NF (Fifth Normal Form)

    Condition:

    4NF me hona chahiye

    Table should be broken down to remove join dependencies. 5NF mainly tab use hoti hai jab data redundant ho due to complex joins.

    Example:
    Suppose ek product multiple vendors se aa raha hai and multiple customers ko jaa raha hai. To avoid unnecessary combinations, hum 5NF apply karte hain.


     Summary Table:

    Normal Form Kya Remove Karta Hai
    1NF Repeating groups/multi-values
    2NF Partial dependency
    3NF Transitive dependency
    BCNF Non-super key determinants
    4NF Multi-valued dependency
    5NF Join dependency
    Scroll to Top