MySQL + SQL · Lesson 1

Normalization In Dbms

Normalization Step by Step

Let us normalize one messy table through 1NF, 2NF and 3NF using a student-course example.

Unnormalized Table

student(roll, name, subjects, teacher, teacher_phone)
1, Aman, "Math,Science", Mr.Rao, 99999
Problems: multiple subjects in one cell, repeated teacher info.

1NF — Atomic Values

student(roll, name, subject, teacher, teacher_phone)
1, Aman, Math, Mr.Rao, 99999
1, Aman, Science, Ms.Sen, 88888

2NF — Remove Partial Dependency

Split so non-key columns depend on the whole key:

enrollment(roll, subject)
subject_info(subject, teacher, teacher_phone)

3NF — Remove Transitive Dependency

teacher_phone depends on teacher, not subject — separate it:

subject_info(subject, teacher)
teacher(teacher, teacher_phone)

Summary

  • 1NF: atomic values. 2NF: no partial dependency. 3NF: no transitive dependency.
  • Each step splits the table to remove a specific problem.
🔗

Share this topic with a friend

यह topic किसी दोस्त को भेजें

Found it useful? Send it to a classmate learning the same thing.

अच्छा लगा? जो दोस्त यही सीख रहा है, उसे भेज दीजिए।

\n

💻 Live Code Editor

Is page ki language (MYSQL) mein code likhein aur turant chalाएं — yahीं, bina kuch install kiye.
Powered by OneCompiler. Agar editor na khule to yahान naye tab mein kholein.

💻 Live Code Editor

Is page ke program yahan ready hain — chalाएं, badlें aur seekhें. Bina kuch install kiye.
Powered by OneCompiler. Editor mein code apne aap aa jata hai — Run dabaakर output dekhें. Agar load na ho to naye tab mein kholें.