This project is a Student Record Management System built using MySQL. It stores student details, subjects, and marks using a normalized relational database design to ensure data integrity and avoid redundancy.
π Database Design The database consists of three tables:
- students Stores basic student information. student_id (Primary Key) name age department
- subjects Stores subject details. subject_id (Primary Key) subject_name (Unique, Not Null)
- marks Stores marks obtained by students in subjects. mark_id (Primary Key) student_id (Foreign Key β students) subject_id (Foreign Key β subjects) marks (0β100 validation)
π This design follows database normalization and resolves the many-to-many relationship between students and subjects.
βοΈ Features Implemented
Relational database design with Primary & Foreign Keys Data validation using NOT NULL, UNIQUE, CHECK constraints CRUD operations Multi-table queries using JOIN Aggregation using GROUP BY Filtering aggregated data using HAVING Clean queries using CTE (Common Table Expressions)
π Sample Queries
-- Total marks of each student SELECT s.name, SUM(m.marks) AS total_marks FROM students s JOIN marks m ON s.student_id = m.student_id GROUP BY s.student_id;
-- Students with average marks above 85 using CTE WITH StudentTotals AS ( SELECT s.student_id, s.name, AVG(m.marks) AS avg_marks FROM students s JOIN marks m ON s.student_id = m.student_id GROUP BY s.student_id ) SELECT * FROM StudentTotals WHERE avg_marks > 85;
π§ Skills Demonstrated MySQL Database Normalization SQL Joins & Aggregations CTEs and Subqueries Data Integrity & Constraints Query Optimization Basics
π How to Run
Open MySQL Workbench Run database.sql to create tables Run sample_data.sql to insert data Run queries from queries.sql
π Project Structure Student-Record-Management-System/ β βββ database.sql βββ sample_data.sql βββ queries.sql βββ README.md