{"id":29149957,"url":"https://github.com/ani811625/csi-assignment4","last_synced_at":"2025-06-30T23:07:55.843Z","repository":{"id":301681944,"uuid":"1010008644","full_name":"Ani811625/CSI-Assignment4","owner":"Ani811625","description":"📊This repository contains the complete solution to the problem statement, assigned as part of the Week 4 deliverables during the Summer Internship Program at Celebal Technologies.","archived":false,"fork":false,"pushed_at":"2025-06-28T06:48:50.000Z","size":0,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-28T07:33:58.547Z","etag":null,"topics":["microsoft-sql-server","sql"],"latest_commit_sha":null,"homepage":"","language":"TSQL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Ani811625.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-28T06:34:04.000Z","updated_at":"2025-06-28T06:48:53.000Z","dependencies_parsed_at":"2025-06-28T07:34:02.107Z","dependency_job_id":"0fc93051-af3b-4903-b160-f1b11a868b99","html_url":"https://github.com/Ani811625/CSI-Assignment4","commit_stats":null,"previous_names":["ani811625/csi-assignment4"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Ani811625/CSI-Assignment4","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ani811625%2FCSI-Assignment4","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ani811625%2FCSI-Assignment4/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ani811625%2FCSI-Assignment4/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ani811625%2FCSI-Assignment4/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Ani811625","download_url":"https://codeload.github.com/Ani811625/CSI-Assignment4/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ani811625%2FCSI-Assignment4/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262864133,"owners_count":23376456,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["microsoft-sql-server","sql"],"created_at":"2025-06-30T23:07:55.226Z","updated_at":"2025-06-30T23:07:55.832Z","avatar_url":"https://github.com/Ani811625.png","language":"TSQL","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# 🎓 Open Elective Subject Allocation System (SQL Project)\n\nThis 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.\n\n---\n\n## 📌 Objective\n\nTo develop a SQL-based system where:\n- Each student submits 5 elective subject preferences.\n- Subjects are allotted based on **descending GPA**.\n- If a subject is full, the next preference is checked.\n- If none are available, the student is marked as **unallotted**.\n\n---\n\n## 🛠️ Tech Stack\n\n| Technology | Purpose               |\n|------------|------------------------|\n| SQL Server | Database \u0026 procedures |\n| T-SQL      | Logic implementation   |\n\n---\n\n## 📊 Database Schema\n\n| Table Name         | Columns                                     | Description                                                                 |\n|--------------------|---------------------------------------------|-----------------------------------------------------------------------------|\n| `StudentDetails`   | `StudentId`, `StudentName`, `GPA`, `Branch`, `Section` | Contains student academic info                                              |\n| `SubjectDetails`   | `SubjectId`, `SubjectName`, `MaxSeats`, `RemainingSeats` | Stores all elective subject details and seat availability                   |\n| `StudentPreference`| `StudentId`, `SubjectId`, `Preference`      | Maps students to their 5 subject preferences (1 = highest priority)         |\n| `Allotments`       | `SubjectId`, `StudentId`                    | Final allotted subject for each student                                     |\n| `UnallotedStudents`| `StudentId`                                 | Students who couldn't be allotted any subject from their preference list    |\n\n---\n\n## 🚀 Setup Instructions\n\n1. **Create the schema**  \n   Execute the SQL scripts in the following order:\n   - `CREATE TABLE` statements for all 5 tables\n   - `INSERT INTO` statements for student/subject/preference data\n\n2. **Create stored procedure**  \n   Run `AllocateOpenElectives` procedure code.\n\n3. **Execute allocation**  \n   ```sql\n   EXEC AllocateOpenElectives;\n   ```\n\n4. **View results**\n   ```sql\n   SELECT * FROM Allotments;\n   SELECT * FROM UnallotedStudents;\n   ```\n\n---\n\n## ⚙️ Allocation Logic\n\n1. Sort all students by **GPA descending**.\n2. For each student:\n   - Check their subject preferences one by one (1 to 5).\n   - If a subject has available seats:\n     - Allot that subject.\n     - Decrease its `RemainingSeats`.\n   - If all preferences are full, mark student as **unallotted**.\n\n---\n\n## 📥 Sample Output\n\n### ✅ Allotted Students\n\n| SubjectId | StudentId   |\n|-----------|-------------|\n| PO1491    | 159103041   |\n| PO1491    | 159103036   |\n| PO1492    | 159103039   |\n| PO1492    | 159103038   |\n| PO1492    | 159103040   |\n| PO1492    | 159103037   |\n\n### ❌ Unallotted Students\n\n\u003e (Empty if all got subjects — populated if some couldn’t be allotted any)\n\n---\n\n## 📁 Files/Folders in This Repo\n\n| File/Folders                           | Description                                 |\n|----------------------------------------|---------------------------------------------|\n| `Queries`                              | All Sql commands/queries                    |\n| `Output`                               | Output of all Sql queries/commands          |\n| `Student Allotment SQL Problem.pdf`    | The `Problem Statement` for the Week 4      |\n| `README.md`                            | This documentation                          |\n\n---\n\n## 👨‍💻 Developed By\n\n**Aniruddha Sarkar**  \n_Student, B.Tech CSE (Cyber Security)_  \n_Techno Main Salt Lake_\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fani811625%2Fcsi-assignment4","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fani811625%2Fcsi-assignment4","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fani811625%2Fcsi-assignment4/lists"}