Skip to content

About

SQL-based University Course Management System featuring 5 relational tables, foreign key constraints, and 16 advanced SQL queries for managing and analyzing academic data.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

🎓 UCMS — University Course Management System

A complete SQL capstone project that designs and manages a University Course Management System — featuring 5 related tables with Foreign Keys, 16 analytical queries covering JOINs, Subqueries, Window Functions, Date Functions, String Functions and CASE statements.


📌 Project Overview

This project builds a fully normalized University Database from scratch — managing Students, Courses, Departments, Instructors and Enrollments — and answers 16 real-world business questions using advanced SQL techniques.


🗂️ Database Schema

UCMS (University Course Management System)
│
├── department    → DepartmentID, DepartmentName
├── students      → StudentID, FirstName, LastName, Email, BirthDate, EnrollmentDate
├── courses       → CourseID, CourseName, DepartmentID*, Credits
├── instructors   → InstructorID, FirstName, LastName, Email, DepartmentID*, Salary
└── enrollment    → EnrollmentID, StudentID*, CourseID*, EnrollmentDate

* = Foreign Key

🚀 16 Queries Covered

Q# Question Concept Used
Q1 CRUD Operations on Students INSERT, UPDATE, DELETE, SELECT
Q2 Students enrolled after 2022 YEAR() + WHERE
Q3 Courses by department JOIN + WHERE
Q4 Student count per course (>1) GROUP BY + HAVING
Q5 Students in both SQL & Data Structure Subquery + HAVING COUNT(DISTINCT)
Q6 Students in SQL or Data Structure JOIN + IN + DISTINCT
Q7 Average credits of all courses AVG()
Q8 Max salary of instructor by department ALTER TABLE + MAX() + JOIN
Q9 Student count per department 3-table JOIN + GROUP BY
Q10 Students with their enrolled courses INNER JOIN (3 tables)
Q11 All students including unenrolled LEFT JOIN (3 tables)
Q12 Students in courses with >1 students Nested Subquery
Q13 Extract enrollment year YEAR()
Q14 Instructor full name CONCAT()
Q15 Running total of students per course COUNT() OVER() Window Function
Q16 Label Senior / Junior by enrollment TIMESTAMPDIFF() + CASE WHEN

🛠️ Tech Stack

  • Database: MySQL
  • Concepts: DDL, DML, Foreign Keys, JOINs, Subqueries, Window Functions, String Functions, Date Functions, CASE, ALTER TABLE
  • Tool: MySQL Workbench

📁 Project Structure

sql-capstone-project/
│
├── Final_Project.sql   # Complete SQL script (16 queries)
└── README.md           # Project documentation

▶️ How to Run

  1. Clone the repository
git clone https://github.com/ravindra-data/sql-capstone-project.git
  1. Open MySQL Workbench

  2. Open Final_Project.sql and run it

  3. Database UCMS will be created with all 5 tables and 16 queries!


📸 Sample Queries & Output

-- Q15: Running Total of Students Per Course
SELECT CourseID,
COUNT(StudentID) OVER(ORDER BY CourseID) AS running_total
FROM enrollment;
-- Output: 1 → 2 → 3 → 4

-- Q16: Senior / Junior Label
SELECT StudentID, FirstName,
CASE
    WHEN TIMESTAMPDIFF(MONTH, EnrollmentDate, CURDATE()) > 1
    THEN 'Senior'
    ELSE 'Junior'
END AS Status FROM students;

-- Q9: Student Count Per Department
-- Computer Science → 2 students
-- Math → 2 students

💡 What I Learned

  • Designing a normalized relational database with Foreign Key constraints
  • Writing complex multi-table JOINs (3 tables at once)
  • Using nested Subqueries to filter based on aggregated data
  • Modifying live tables using ALTER TABLE to add new columns
  • Applying Window Functions — COUNT() OVER() for running totals
  • Labeling data dynamically using CASE WHEN TIMESTAMPDIFF()
  • Answering 16 real-world business questions using SQL

About

SQL-based University Course Management System featuring 5 relational tables, foreign key constraints, and 16 advanced SQL queries for managing and analyzing academic data.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors