Loading Page Content...
Preparing courses, live labs, and learning resources.सामग्री लोड हो रही है, कृपया प्रतीक्षा करें...
Preparing courses, live labs, and learning resources.सामग्री लोड हो रही है, कृपया प्रतीक्षा करें...
Why do we bother splitting data across multiple tables linked by foreign keys instead of keeping everything in one giant, convenient table? The answer lies in Data Anomalies.
When database schemas are poorly designed or left unnormalized, daily data operations cause severe data corruption, accidental data loss, and update inconsistencies known as Insertion, Update, and Deletion Anomalies.
Consider an institute that stores student enrollments, courses, and instructor details in a single table:
Notice the rampant data redundancy: Dr. Ramesh's name, course title, and phone number are copy-pasted across every single student row!
An Insertion Anomaly occurs when you cannot record certain information without also recording completely unrelated data.
Suppose the institute launches a brand-new course: "Cloud Computing & DevOps (CC3)", taught by Dr. Sunita. However, registration just opened and no students have enrolled yet.
Question: Can we insert this new course into student_course_monolith? Answer: NO! Because student_id is part of the table's identity/primary key, and cannot be NULL. To record the course, we would be forced to invent a fake "dummy" student or leave the course unrecorded!
An Update Anomaly occurs when modifying a single real-world fact requires updating multiple rows, creating data inconsistency if any row is missed.
Suppose Dr. Ramesh changes his mobile phone number to 9820099999.
UPDATE statement must update all 500 rows.9820099999.9820011111!A Deletion Anomaly occurs when deleting certain records unintentionally destroys completely unrelated valuable information.
Look at student 104 (Ananya) in the table above: she is currently the only student enrolled in "Web Designing (WD2)".
DELETE FROM student_course_monolith WHERE student_id = 104;To eliminate these three anomalies, relational databases apply Normalization: decomposing the monolith into three dedicated, specialized tables linked by clean foreign keys:
students (Student attributes only).instructors (Instructor attributes only).courses (Course attributes referencing instructor).enrollments (Junction table linking students to courses).Continue learning with hands-on practice, examples, and exercises in the upcoming topic.
| Previous Lesson | Next Lesson |
|---|---|
| Advanced Null Handling with NULLIF & COALESCE | First Normal Form (1NF) |
Test your understanding of this lesson with 5 questions. Each question has one correct answer.