๐ŸŽ“ Educational System๐Ÿ—„๏ธ SQL Server Database๐Ÿ”’ RBAC Security

ITI Examination SystemDatabase Management

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.

SQL Server - Relational database
SQL Server
T-SQL
SSMS
Docker - Containerization
Docker
ITI Examination System - Entity Relationship Diagram
๐Ÿš€ View GitHub Repository

Problem & Motivation

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.

System Architecture

Comprehensive database system with normalized schema, security, and automation

01

Database Design

Normalized relational database schema with 15+ tables managing users, students, instructors, courses, exams, and questions

Normalization:

3NF design eliminating redundancy while maintaining referential integrity

Entity Relationships:

Proper foreign key constraints and junction tables for many-to-many relationships

02

Security & RBAC

Role-based access control system with four distinct roles and granular permissions

Four Roles:

Admin, Training Manager, Instructor, and Student with role-specific views and procedures

Secure Access:

IAM-style security schema with master procedure for user login provisioning

03

Business Logic

Stored procedures and functions implementing core examination workflow automation

Exam Management:

Procedures for creating exams, submitting answers, and calculating results

Result Calculation:

User-defined functions for automated score calculation and grade determination

04

Automation & Auditing

Database triggers for automated processes and complete audit trail maintenance

Auto-Calculations:

Triggers automatically calculate exam end times and validate business rules

Audit Logging:

Complete audit trail tracking all data changes with user, timestamp, and JSON snapshots

System Impact Summary

15+
Database Tables
90%
Work Reduction
4 Roles
RBAC System

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.

System Workflow

Complete examination lifecycle from course creation to result calculation

1

Course & Question Management

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.

2

Exam Creation

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.

3

Student Examination

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.

4

Result Calculation & Review

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.

Data Model Architecture

Normalized relational database with 3NF design

Entity Relationship Diagram

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.

Challenges & Solutions

Key challenges overcome during the development process and their strategic solutions

Database Normalization

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

Role-Based Access Control (RBAC)

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

Process Automation

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

Data Integrity & Auditing

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

Key Achievements

Measurable impact on examination management efficiency and data integrity

Workflow Automation

Manual Work Reduction90%
15+
Tables
10+
Procedures
5+
Triggers

Automated exam creation and grading

๐ŸŽฏ Staff focus on educational quality

Data Integrity

100%
Referential Integrity
โœ“ Zero Inconsistencies

15+ tables interconnected with FK constraints

๐ŸŽฏ Reliable examination records

Security Compliance

Admin
Full Access
Instructor
Create Exams
Student
Take Exams
Viewer
Read Only

4 distinct roles with granular permissions

๐ŸŽฏ Complete audit trail logging

Code Showcase

Interactive code browser - click on any file tab to explore the implementation

Data Definition Language - Database Schema

T-SQL
-- 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)
);
GO

Key Learnings & Future Vision

Key learnings from implementation and strategic vision for evolving capabilities

๐Ÿ’ก Key Learnings

Database Design Patterns

Mastered normalization techniques, junction tables, and referential integrity for complex relational databases

T-SQL Advanced Features

Gained expertise in stored procedures, user-defined functions, triggers, and views for business logic implementation

Security Best Practices

Learned RBAC implementation, security schemas, and audit trail design for enterprise database systems

Process Automation

Understood how to automate workflows using database triggers and stored procedures to reduce manual overhead

๐Ÿš€ Future Enhancements

Real-time Notifications

Add SQL Server Service Broker for real-time exam notifications and result alerts

Advanced Analytics

Implement data warehouse for historical performance analysis and predictive insights

API Integration

Build REST API layer using ASP.NET Core for web and mobile application integration

Machine Learning

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."
โ€” Engineering Philosophy

"ุชูŽุนูŽุจู ูƒูู„ู‘ู‡ุง ุงู„ุญูŽูŠุงุฉู."

ยฉ 2025 Yousef Mahmoud | Data Engineering Portfolio