Normalisasi Database

Unnormalized data example :

Student IDStudent NameDate of BirthTeacherSubject
98765432John Smith2006-05-12Mr. SmithMathematics
12345678Emily Johnson2007-09-21Ms. JonesScience
87654321Michael Brown2005-11-03Mr. BrownEnglish
54321678Sarah Lee2006-08-17Mrs. LeeHistory
87654321Michael Brown2005-11-03Mrs. GarciaGeography
98765432John Smith2006-05-12Mr. JohnsonPhysics
  • Rows with Student ID 87654321 and 98765432 are duplicates with different Teacher and Subject.
After Normalized

To normalize this table, we'll split it into multiple tables to eliminate redundancy and improve data integrity. We'll create separate tables for Students, Teachers, Subjects, and a table to manage the relationships between them.

Students Table:

Student IDStudent NameDate of Birth
98765432John Smith2006-05-12
12345678Emily Johnson2007-09-21
87654321Michael Brown2005-11-03
54321678Sarah Lee2006-08-17

Teachers Table:

Teacher IDTeacher Name
1Mr. Smith
2Ms. Jones
3Mr. Brown
4Mrs. Lee
5Mrs. Garcia
6Mr. Johnson

Subjects Table:

Subject IDSubject
1Mathematics
2Science
3English
4History
5Geography
6Physics

Student-Teacher Relationship Table:

Student IDTeacher ID
987654321
123456782
876543213
543216784
876543215
987654326

Student-Subject Relationship Table:

Student IDSubject ID
987654321
123456782
876543213
543216784
876543215
987654326

In this normalized structure:

  • Each table stores data about a specific entity (students, teachers, subjects).
  • Relationships between entities are managed in separate tables (student-teacher and student-subject relationships).
  • Redundancy is minimized, and data integrity is improved.

0 comments:

Posting Komentar