DEV Community

Cover image for πŸŽ“ College Student & Course Management System with SQL (Step by Step)
ROHITH
ROHITH

Posted on

πŸŽ“ College Student & Course Management System with SQL (Step by Step)

πŸŽ“ 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)