Overview
This lecture explains how to use Entity-Relationship Diagrams (ERDs) for student data and demonstrates the process of database normalization.
Introduction to ERD
- ERD (Entity-Relationship Diagram) visually maps entities (tables) and their relationships in a database.
- Entities represent real-world objects; attributes describe properties of those entities.
Student Data Example
- Student information may include name, student ID, address, and enrolled courses.
- Initially, all student data and course enrollments might be stored in a single table.
Problems with Unnormalized Data
- Storing repeated information (like courses) in one table leads to redundancy and data anomalies.
- Updating or deleting data can cause errors when information is duplicated.
Normalization Steps
- Normalization organizes data to reduce redundancy and improve data integrity.
- First Normal Form (1NF): Ensures each table cell has a single valueβno repeating groups.
- Second Normal Form (2NF): Removes subsets of data that apply to multiple rows; creates separate tables for related data.
- Third Normal Form (3NF): Eliminates fields not dependent on the entity's primary key.
Resulting Normalized Structure
- Separate tables are created for Students, Courses, and Enrollments to link the two.
- Use primary keys (unique IDs) and foreign keys to connect tables.
Key Terms & Definitions
- ERD (Entity-Relationship Diagram) β diagram showing entities and their relationships in a database.
- Normalization β process of organizing data to minimize redundancy.
- Primary Key β unique identifier for table records.
- Foreign Key β a field linking one table to another.
Action Items / Next Steps
- Practice drawing an ERD for sample student and course data.
- Normalize example tables to 1NF, 2NF, and 3NF.
- Review key terms and definitions.