Project Overview

Solving real-world academic data management challenges with MySQL

About the Project

The Academic Records System is a comprehensive MySQL database solution designed to address critical challenges in academic data management for higher education institutions. This project was developed as part of the Database Management (MySQL) course at my Institute.

Project Challenge

My Institute was facing several critical issues in their academic records management:

  • Invalid student registrations leading to "ghost entries" in exams
  • No systematic tracking of daily performance metrics
  • Concurrency issues when multiple users accessed the system simultaneously
  • Unauthorized changes to exam marks without audit trails
MySQL
Database Design
Stored Procedures
Triggers
Views
Transaction Management
Database Schema

Key Features

Comprehensive database functionality addressing all project requirements

Data Integrity & Validation

Implemented CHECK constraints, foreign keys, and unique constraints to ensure data validity and prevent invalid registrations.

Performance Tracking

Automated calculation of pass/fail rates, distinctions, and average marks with daily statistics updates.

Concurrency Control

Implemented transaction management with appropriate isolation levels to handle multiple simultaneous users.

Audit Trail

Comprehensive logging of all exam mark changes with before/after values and user information.

Top Performers Tracking

Automatic identification and storage of exceptional student performances (marks > 90).

Data Views

Created updatable views for simplified access to student status and performance metrics by city.

Implementation Details

Technical implementation of database objects and functionality

Database Schema Design

The database consists of 6 main tables with appropriate relationships and constraints:

-- Student table with validation constraints CREATE TABLE student ( student_id INT AUTO_INCREMENT PRIMARY KEY, first_name VARCHAR(45) NOT NULL, surname VARCHAR(45) NOT NULL, email VARCHAR(100) UNIQUE NOT NULL CHECK (email LIKE "%@%.%"), phone VARCHAR(45) NOT NULL, city VARCHAR(50) NOT NULL, registration_date DATE NOT NULL );

Stored Procedures & Functions

Implemented comprehensive business logic through stored procedures and functions:

-- Procedure to validate and insert exam records DELIMITER // CREATE PROCEDURE sp_Insert_Exam_With_Validation( IN p_student_id INT, IN p_module_id INT, IN p_exam_date DATE, IN p_total_mark DECIMAL(5,2) ) BEGIN -- Transaction with REPEATABLE READ isolation SET TRANSACTION ISOLATION LEVEL REPEATABLE READ; START TRANSACTION; -- Check enrollment before insertion IF NOT EXISTS (SELECT 1 FROM student_module WHERE student_id = p_student_id AND module_id = p_module_id) THEN SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'Student not enrolled in module'; ELSE INSERT INTO exam (student_id, module_id, exam_date, total_mark) VALUES (p_student_id, p_module_id, p_exam_date, p_total_mark); COMMIT; END IF; END // DELIMITER ;

Triggers for Automation

Implemented triggers to automate audit trails and performance tracking:

-- Trigger to log mark changes DELIMITER // CREATE TRIGGER trg_exam_before_update BEFORE UPDATE ON exam FOR EACH ROW BEGIN INSERT INTO exam_audit (exam_id, old_total_mark, new_total_mark, changed_by) VALUES (OLD.exam_id, OLD.total_mark, NEW.total_mark, CURRENT_USER()); END // DELIMITER ;

Views for Data Access

Created updatable views to simplify complex data access patterns:

-- View showing student status (Pass, Fail, Distinction) CREATE VIEW vw_status AS SELECT e.student_id, e.module_id, m.module_name, s.first_name, s.surname, e.total_mark, CASE WHEN e.total_mark >= 80 THEN 'Distinction' WHEN e.total_mark >= 50 THEN 'Pass' ELSE 'Fail' END AS status FROM exam e JOIN student s ON s.student_id = e.student_id JOIN module m ON m.module_id = e.module_id;

Project Results

Successfully addressed all project requirements with robust database solutions

Key Achievements

  • Eliminated "ghost entries" by implementing enrollment validation in exam insertion procedures
  • Enabled daily performance tracking through automated statistics procedures
  • Resolved concurrency issues with proper transaction management and isolation levels
  • Created comprehensive audit trails for all exam mark changes
  • Automated identification and tracking of top-performing students
  • Provided simplified data access through updatable views

Sample Data Implementation

The database was populated with realistic sample data to demonstrate functionality:

-- Sample exam data INSERT INTO exam (student_id, module_id, exam_date, total_mark) VALUES (1, 1, '2023-06-15', 85.5), (1, 2, '2023-06-20', 72.0), (2, 1, '2023-06-15', 91.0), (2, 3, '2023-06-25', 68.5);

Database Backup

Created a comprehensive database backup with all schema definitions and sample data, ensuring the project can be easily deployed and tested.