DEV Community

Saifulhaq S
Saifulhaq S

Posted on

NORMALISATION

Understanding Normalization with SQL – 1NF, 2NF, 3NF
When working with databases, we often face redundancy, inconsistency, and anomalies. Normalization helps solve these issues by organizing data into well-structured tables.

📌 Base Table (Unnormalized Data)

🔎 Anomalies Identified
Insertion: Cannot add a new course unless a student registers.
Update: Changing instructor name requires multiple updates.
Deletion: Deleting a student may remove course data too.

✅ First Normal Form (1NF)
We ensure atomic values and primary keys.


✅ Second Normal Form (2NF)
We remove partial dependencies by separating Students and Courses.



✅ Third Normal Form (3NF)
We remove transitive dependencies by separating Instructors.




📥 Sample Data Insertions




🔗 Query with JOINs

🎯 Conclusion
By applying 1NF → 2NF → 3NF, we eliminated redundancy, prevented anomalies, and achieved a clean database design. This structured design makes querying and maintenance much easier.

Top comments (0)