π College Student & Course Management System with SQL (Step by Step)
Managing students, courses, and faculty is one of the most common real-world scenarios in colleges and universities. In this blog post, weβll design and implement a College Student & Course Management System using Oracle SQL.
Weβll go through 10 practical SQL tasks that will help you strengthen your skills:
β
Table creation (DDL)
β
Data insertion (DML)
β
Altering & constraints
β
Queries with functions
β
Aggregates & GROUP BY
β
Joins & Views
β
Stored Procedures
By the end, youβll have a mini student management system that can be extended for larger projects.
π Database Schema
We start with three core tables:
π¨βπ Students β Stores student details
π Courses β Stores course information
π Enrollments β Many-to-many relationship (students taking multiple courses)
And later, weβll add Faculty.
π Implementation β Step by Step
1οΈβ£ Create Faculty Table
CREATE TABLE Faculty (
FacultyID NUMBER PRIMARY KEY,
FacultyName VARCHAR2(50) NOT NULL,
Dept VARCHAR2(30),
Email VARCHAR2(50) UNIQUE
);
2οΈβ£ Insert Students
INSERT INTO Students (StudentID, NAME_, Dept, DOB, Email)
VALUES (1, 'Ramana Raj', 'CSE', TO_DATE('2003-05-12', 'YYYY-MM-DD'), 'ramana123@gmail.com');
INSERT INTO Students (StudentID, NAME_, Dept, DOB, Email)
VALUES (2, 'Thimbesh', 'ECE', TO_DATE('2002-09-21', 'YYYY-MM-DD'), 'thimbesh123@gmail.com');
INSERT INTO Students (StudentID, NAME_, Dept, DOB, Email)
VALUES (3, 'Mouliswaran', 'Mechanical', TO_DATE('2001-12-02', 'YYYY-MM-DD'), 'mouliswaran44@gmail.com');
3οΈβ£ Alter Students Table (Add Phone No.)
ALTER TABLE Students ADD PhoneNo NUMBER(10);
4οΈβ£ Add Constraint to Courses
ALTER TABLE Courses
ADD CONSTRAINT chk_credits CHECK (Credits BETWEEN 1 AND 5);
5οΈβ£ Functions β Names in UPPERCASE & Email Length
SELECT UPPER(Name) AS StudentNameUpper,
LENGTH(Email) AS EmailLength
FROM Students;
6οΈβ£ Aggregates β Avg Credits & Total Students Enrolled
SELECT AVG(Credits) AS AvgCredits FROM Courses;
SELECT COUNT(DISTINCT StudentID) AS TotalStudentsEnrolled
FROM Enrollments;
7οΈβ£ JOIN β Students with Courses & Grades
SELECT s.Name AS StudentName, c.CourseName, e.Grade
FROM Enrollments e
JOIN Students s ON e.StudentID = s.StudentID
JOIN Courses c ON e.CourseID = c.CourseID;
8οΈβ£ GROUP BY + HAVING
SELECT Dept, COUNT() AS StudentCount
FROM Students
GROUP BY Dept
HAVING COUNT() > 2;
9οΈβ£ Create View (StudentCoursesView)
CREATE VIEW StudentCoursesView AS
SELECT s.Name AS StudentName, c.CourseName, e.Grade
FROM Enrollments e
JOIN Students s ON e.StudentID = s.StudentID
JOIN Courses c ON e.CourseID = c.CourseID;
π Stored Procedure β Update Grade
CREATE OR REPLACE PROCEDURE UpdateGrade (
p_StudentID IN NUMBER,
p_CourseID IN NUMBER,
p_NewGrade IN CHAR
) AS
BEGIN
UPDATE Enrollments
SET Grade = p_NewGrade
WHERE StudentID = p_StudentID
AND CourseID = p_CourseID;
COMMIT;
END;
π― Summary
In this blog post, we built a mini College Student & Course Management System using SQL:
π Designed tables for Students, Courses, Faculty & Enrollments
β Inserted and managed data with DDL & DML
π Applied constraints for data integrity
π Queried using functions, aggregates, joins, and group by
π Created a View for simplified reporting
β Automated updates with a Stored Procedure
π This project covers almost all core SQL concepts and can easily be extended to include:
Attendance tracking
Faculty-course mapping
Timetable management
Reports & dashboards
π‘ If youβre preparing for SQL interviews or college DBMS projects, this example is a solid foundation to practice and showcase.
Top comments (0)