Design a Normalized Enrollment Database
Transform a repeated enrollment spreadsheet into related student, course, section, and enrollment tables.
Explanation
Normalization organizes data to reduce unnecessary repetition and update anomalies. A reliable design separates entities, assigns stable primary keys, and connects records through foreign keys.
Students examine a deliberately messy enrollment sheet, identify functional dependencies, and redesign it into related tables. The class tests whether common inserts, updates, and deletions remain consistent.
Learning activities
- Mark repeating data in a sample enrollment sheet.
- Identify entities, keys, and relationships.
- Create a schema approaching third normal form.
Code example
sql
CREATE TABLE enrollments (
student_id BIGINT NOT NULL,
section_id BIGINT NOT NULL,
enrolled_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (student_id, section_id)
);Knowledge check
1. Why is repeated course data risky?
- It creates update anomalies
- It makes keys shorter
- It prevents all queries
Show answer
It creates update anomalies