Unnormalized data example :
Student ID | Student Name | Date of Birth | Teacher | Subject |
---|---|---|---|---|
98765432 | John Smith | 2006-05-12 | Mr. Smith | Mathematics |
12345678 | Emily Johnson | 2007-09-21 | Ms. Jones | Science |
87654321 | Michael Brown | 2005-11-03 | Mr. Brown | English |
54321678 | Sarah Lee | 2006-08-17 | Mrs. Lee | History |
87654321 | Michael Brown | 2005-11-03 | Mrs. Garcia | Geography |
98765432 | John Smith | 2006-05-12 | Mr. Johnson | Physics |
- Rows with Student ID
87654321
and98765432
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 ID | Student Name | Date of Birth |
---|---|---|
98765432 | John Smith | 2006-05-12 |
12345678 | Emily Johnson | 2007-09-21 |
87654321 | Michael Brown | 2005-11-03 |
54321678 | Sarah Lee | 2006-08-17 |
Teachers Table:
Teacher ID | Teacher Name |
---|---|
1 | Mr. Smith |
2 | Ms. Jones |
3 | Mr. Brown |
4 | Mrs. Lee |
5 | Mrs. Garcia |
6 | Mr. Johnson |
Subjects Table:
Subject ID | Subject |
---|---|
1 | Mathematics |
2 | Science |
3 | English |
4 | History |
5 | Geography |
6 | Physics |
Student-Teacher Relationship Table:
Student ID | Teacher ID |
---|---|
98765432 | 1 |
12345678 | 2 |
87654321 | 3 |
54321678 | 4 |
87654321 | 5 |
98765432 | 6 |
Student-Subject Relationship Table:
Student ID | Subject ID |
---|---|
98765432 | 1 |
12345678 | 2 |
87654321 | 3 |
54321678 | 4 |
87654321 | 5 |
98765432 | 6 |
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.
Komentar
Posting Komentar