This project implements an automated subject allocation system for students based on their GPA and subject preferences. It ensures fair and optimized distribution of elective subjects, considering seat availability and student priorities.
To develop a SQL-based system where:
- Each student submits 5 elective subject preferences.
- Subjects are allotted based on descending GPA.
- If a subject is full, the next preference is checked.
- If none are available, the student is marked as unallotted.
| Technology | Purpose |
|---|---|
| SQL Server | Database & procedures |
| T-SQL | Logic implementation |
| Table Name | Columns | Description |
|---|---|---|
StudentDetails |
StudentId, StudentName, GPA, Branch, Section |
Contains student academic info |
SubjectDetails |
SubjectId, SubjectName, MaxSeats, RemainingSeats |
Stores all elective subject details and seat availability |
StudentPreference |
StudentId, SubjectId, Preference |
Maps students to their 5 subject preferences (1 = highest priority) |
Allotments |
SubjectId, StudentId |
Final allotted subject for each student |
UnallotedStudents |
StudentId |
Students who couldn't be allotted any subject from their preference list |
-
Create the schema
Execute the SQL scripts in the following order:CREATE TABLEstatements for all 5 tablesINSERT INTOstatements for student/subject/preference data
-
Create stored procedure
RunAllocateOpenElectivesprocedure code. -
Execute allocation
EXEC AllocateOpenElectives;
-
View results
SELECT * FROM Allotments; SELECT * FROM UnallotedStudents;
- Sort all students by GPA descending.
- For each student:
- Check their subject preferences one by one (1 to 5).
- If a subject has available seats:
- Allot that subject.
- Decrease its
RemainingSeats.
- If all preferences are full, mark student as unallotted.
| SubjectId | StudentId |
|---|---|
| PO1491 | 159103041 |
| PO1491 | 159103036 |
| PO1492 | 159103039 |
| PO1492 | 159103038 |
| PO1492 | 159103040 |
| PO1492 | 159103037 |
(Empty if all got subjects β populated if some couldnβt be allotted any)
| File/Folders | Description |
|---|---|
Queries |
All Sql commands/queries |
Output |
Output of all Sql queries/commands |
Student Allotment SQL Problem.pdf |
The Problem Statement for the Week 4 |
README.md |
This documentation |
Aniruddha Sarkar
Student, B.Tech CSE (Cyber Security)
Techno Main Salt Lake