A comprehensive normalized relational database system using SQL Server (T-SQL) to manage students, courses, and exams with automated processes, role-based access control, and complete audit trail.

The Information Technology Institute (ITI) needed a comprehensive system to manage students, courses, instructors, and examinations across multiple branches and tracks. Manual processes for exam scheduling, result calculation, and student record management were time-consuming and error-prone.
This project builds a production-grade relational database system using SQL Server and T-SQL that automates 90% of examination workflows. By implementing normalized database design, role-based access control, stored procedures, and audit triggers, this solution enables efficient management of the entire examination lifecycle while maintaining data integrity and security compliance.
Comprehensive database system with normalized schema, security, and automation
Normalized relational database schema with 15+ tables managing users, students, instructors, courses, exams, and questions
3NF design eliminating redundancy while maintaining referential integrity
Proper foreign key constraints and junction tables for many-to-many relationships
Role-based access control system with four distinct roles and granular permissions
Admin, Training Manager, Instructor, and Student with role-specific views and procedures
IAM-style security schema with master procedure for user login provisioning
Stored procedures and functions implementing core examination workflow automation
Procedures for creating exams, submitting answers, and calculating results
User-defined functions for automated score calculation and grade determination
Database triggers for automated processes and complete audit trail maintenance
Triggers automatically calculate exam end times and validate business rules
Complete audit trail tracking all data changes with user, timestamp, and JSON snapshots
This comprehensive database system manages students, courses, and examinations across multiple branches, enabling efficient examination workflows with automated processes, secure access control, and complete audit trail.
Complete examination lifecycle from course creation to result calculation
Instructors: Create courses with metadata (name, description, max/min degrees, hours). Build question bank with multiple question types: Multiple-Choice (MCQ), True/False, and Text-based questions.
Training Managers: Manage branches, tracks, departments, and intakes. Assign courses to specific branch-intake-track combinations.
Manual Creation: Instructors create exams manually, selecting specific questions from the question bank.
Random Generation: Instructors can generate exams randomly with specified question count. System supports random question order for enhanced security.
Automation: Triggers automatically calculate exam end times based on start time and duration.
Exam Access: Students view available exams through role-based views (v_Student_Exams). System enforces time windows and access permissions.
Answer Submission: Students submit answers through stored procedures (sp_Student_SubmitAnswer). System automatically validates answers and calculates marks.
Automated Calculation: User-defined functions (FN_CalculateExamResult) automatically calculate total scores and grades.
Instructor Review: Instructors can review text-based answers, adjust marks, and provide feedback through review procedures.
Audit Trail: All changes are logged in audit tables with user, timestamp, and before/after values.
Normalized relational database with 3NF design
Core Entities
Users, Students, Instructors, TrainingManager
Academic
Courses, Exams, Questions, BranchIntakeTrack
Organizational
Branches, Tracks, Departments, Intakes
Examination
StudentAnswers, QuestionChoices, QuestionText
15+ Normalized Tables
With proper foreign key relationships, junction tables for M:M relationships, and audit tables for change tracking
The database follows 3NF normalization principles with 15+ interconnected tables. Core entities include Users, Students, Instructors, and Training Managers. Academic entities manage Courses, Exams, and Questions. Organizational structure includes Branches, Tracks, Departments, and Intakes. Junction tables handle many-to-many relationships, and audit tables maintain complete change history for compliance and security.
Key challenges overcome during the development process and their strategic solutions
Problem
Designing a normalized relational database to eliminate redundancy while maintaining referential integrity across 15+ interconnected tables
Solution
Applied 3NF normalization principles, created junction tables for many-to-many relationships, and implemented proper foreign key constraints
Result
Optimized database structure with zero data redundancy and 100% referential integrity
Problem
Implementing secure permission system with four distinct roles (Admin, Training Manager, Instructor, Student) requiring different data access levels
Solution
Created database roles, granted specific permissions on views and stored procedures, implemented security schema with master procedure for user provisioning
Result
90% reduction in manual work with automated role-based access and secure user management
Problem
Manual exam scheduling, result calculation, and answer storage processes consuming significant administrative time
Solution
Implemented stored procedures for exam creation, automated result calculation functions, and triggers for audit logging and end-time calculation
Result
Automated 90% of examination workflow, reducing administrative overhead significantly
Problem
Ensuring data consistency and maintaining complete audit trail for critical changes to student records and exam data
Solution
Created audit triggers that log all INSERT, UPDATE, DELETE operations with user information, timestamps, and before/after values in JSON format
Result
Complete audit trail with 100% data change tracking and compliance-ready logging
Measurable impact on examination management efficiency and data integrity
Automated exam creation and grading
๐ฏ Staff focus on educational quality
15+ tables interconnected with FK constraints
๐ฏ Reliable examination records
4 distinct roles with granular permissions
๐ฏ Complete audit trail logging
Interactive code browser - click on any file tab to explore the implementation
-- Core Tables Structure
CREATE TABLE dbo.Users (
UserID INT IDENTITY(1,1) PRIMARY KEY,
Username VARCHAR(50) NOT NULL UNIQUE,
[Password] VARCHAR(255) NOT NULL,
UserType VARCHAR(20) NOT NULL
);
GO
CREATE TABLE dbo.Students (
StudentID INT IDENTITY(1,1) PRIMARY KEY,
UserID INT NOT NULL,
NationalID CHAR(14) NOT NULL,
FirstName VARCHAR(50) NOT NULL,
LastName VARCHAR(50) NOT NULL,
Email VARCHAR(100) NOT NULL,
Phone VARCHAR(15) NULL,
Address VARCHAR(200) NULL,
EnrollmentDate DATE NOT NULL,
BranchIntakeTrackID INT NOT NULL,
IsActive BIT NOT NULL DEFAULT(1),
CONSTRAINT FK_Students_User FOREIGN KEY (UserID) REFERENCES dbo.Users(UserID),
CONSTRAINT FK_BranchIntakeTrack FOREIGN KEY (BranchIntakeTrackID)
REFERENCES dbo.BranchIntakeTrack(BranchIntakeTrackID)
);
GO
CREATE TABLE dbo.Exams (
ExamID INT IDENTITY(1,1) PRIMARY KEY,
ExamTitle VARCHAR(200) NOT NULL,
ExamType VARCHAR(50) NOT NULL,
TotalDegrees DECIMAL(5,2) NOT NULL,
ExamDuration INT NOT NULL,
StartDateTime DATETIME NOT NULL,
EndDateTime DATETIME NOT NULL,
IsRandomOrder BIT NOT NULL DEFAULT(0),
QuestionNumber INT NOT NULL,
CourseID INT NOT NULL,
InstructorID INT NOT NULL,
BranchIntakeTrackID INT NOT NULL,
CONSTRAINT FK_Exams_Course FOREIGN KEY (CourseID) REFERENCES dbo.Courses(CourseID),
CONSTRAINT FK_Exams_Instructor FOREIGN KEY (InstructorID) REFERENCES dbo.Instructors(InstructorID)
);
GOKey learnings from implementation and strategic vision for evolving capabilities
Mastered normalization techniques, junction tables, and referential integrity for complex relational databases
Gained expertise in stored procedures, user-defined functions, triggers, and views for business logic implementation
Learned RBAC implementation, security schemas, and audit trail design for enterprise database systems
Understood how to automate workflows using database triggers and stored procedures to reduce manual overhead
Add SQL Server Service Broker for real-time exam notifications and result alerts
Implement data warehouse for historical performance analysis and predictive insights
Build REST API layer using ASP.NET Core for web and mobile application integration
Add ML models for question difficulty prediction and adaptive exam generation
"Database engineering is about designing systems that not only store data efficiently, but automate workflows, enforce business rules, and maintain data integrityโturning complexity into simplicity."
"ุชูุนูุจู ูููููุง ุงูุญููุงุฉู."
ยฉ 2025 Yousef Mahmoud | Data Engineering Portfolio