Overview
The Enrollment Management system allows administrators to register students in courses, manage course rosters, and prevent duplicate enrollments. Enrollments create the link between students and courses, enabling grade tracking and timetable access.Student Enrollment
Register students in specific courses
Enrollment Listing
View all active enrollments with student and course details
Duplicate Prevention
Automatic detection of duplicate enrollments
Enrollment Deletion
Remove students from courses
What is an Enrollment?
An enrollment represents a student’s registration in a specific course. For example:- “John Doe enrolled in Mathematics (taught by Mr. Smith)”
- “Jane Smith enrolled in Physics (taught by Dr. Johnson)”
Enrollment Components:
- Student: The enrolled student
- Course: The specific course instance (subject + teacher)
- Composite Key: Combination of student_id and course_id must be unique
Database Schema
Schema Design Explanation
Schema Design Explanation
Composite Primary Key:
- Uses both
student_idandcourse_idas primary key - Automatically prevents duplicate enrollments at database level
- A student can only be enrolled once in any given course
- If student is deleted, all their enrollments are removed
- If course is deleted, all enrollments in that course are removed
- Maintains data integrity automatically
Enrollment Operations
Viewing All Enrollments
Administrators can view complete enrollment roster:Query Breakdown
Query Breakdown
This complex query joins multiple tables:
- enrollments → students: Get student information
- students → users: Get student name and details
- enrollments → courses: Get course information
- courses → subjects: Get subject name
- Student ID and name
- Course ID and subject name
- All data needed for enrollment management
Creating Enrollments
Enrollment creation with duplicate prevention:Enrollment Workflow:
- Admin selects student from dropdown
- Admin selects course from dropdown
- System checks for duplicate enrollment
- If duplicate, redirect with error message
- If unique, create enrollment record
- Student can now access course in their timetable and receive grades
Duplicate Detection
Prevents students from being enrolled multiple times in the same course:Why Check Duplicates?
- Provides user-friendly error messages
- Allows controlled handling of duplicate attempts
- Database composite key also prevents duplicates, but checking first gives better UX
Deleting Enrollments
Remove a student from a course:Deletion Effects:
- Student loses access to course in timetable
- Grades for this course remain in database (not deleted)
- Can be re-enrolled later if needed
Student-Specific Queries
Getting Student’s Enrollments
Retrieve all courses a student is enrolled in:- Timetable Generation: Show only enrolled courses in student’s schedule
- Grade Display: Show grades only for enrolled courses
- Bulletin Generation: Calculate averages from enrolled courses
Integration with Other Systems
Grade Entry (Teacher Perspective)
Teachers can only enter grades for enrolled students:Query Explanation
Query Explanation
This query:
- Starts with enrollments for the course
- Joins to get student information
- LEFT JOINs grades (may not exist yet)
- Shows all enrolled students with their current grade (or NULL)
- Teachers see complete enrollment roster
- Existing grades are displayed
- Students without grades show NULL (can add grade)
- Only enrolled students appear in the list
Timetable Access (Student Perspective)
Students only see timetable entries for enrolled courses:JOIN enrollments filters timetable to only enrolled courses.
Bulletin Generation
Bulletins include grades from all enrolled courses:Note: This query uses
grades table, not enrollments. Students may be
enrolled in courses without grades yet. Bulletin only shows courses with
recorded grades.Complete Enrollment Model
API Endpoints
| Method | Endpoint | Access | Description |
|---|---|---|---|
| GET | /enrollments | Admin | List all enrollments |
| GET | /enrollments/create | Admin | Show enrollment form |
| POST | /enrollments/store | Admin | Create new enrollment |
| GET | /enrollments/delete?student_id={sid}&course_id={cid} | Admin | Delete enrollment |
Use Cases
Scenario 1: Enrolling a New Student
Scenario 1: Enrolling a New Student
Context: John Doe needs to be enrolled in MathematicsSteps:
- Admin navigates to
/enrollments/create - Selects “John Doe” from students dropdown
- Selects “Mathematics - Mr. Smith” from courses dropdown
- Submits form
- System checks:
isAlreadyEnrolled(john_id, math_course_id) - If not enrolled, creates enrollment record
- John can now see Mathematics in his timetable
- Mr. Smith can enter grades for John in Mathematics
Scenario 2: Duplicate Enrollment Attempt
Scenario 2: Duplicate Enrollment Attempt
Context: Admin tries to enroll John in Mathematics againSteps:
- Admin selects “John Doe” and “Mathematics - Mr. Smith”
- Submits enrollment form
- System checks:
isAlreadyEnrolled(john_id, math_course_id)→ true - Redirects to
/enrollments/create?error=duplicate - Shows error message: “Student already enrolled”
- No duplicate enrollment created
Scenario 3: Removing Student from Course
Scenario 3: Removing Student from Course
Context: Jane Smith needs to drop PhysicsSteps:
- Admin views enrollment list
- Finds “Jane Smith - Physics”
- Clicks delete button
- System calls
delete(jane_id, physics_course_id) - Enrollment record removed
- Jane no longer sees Physics in her timetable
- Physics teacher no longer sees Jane in course roster
- Jane’s Physics grades remain in database (historical record)
Data Flow Diagram
Central Role of Enrollments:
Enrollments are the bridge between students and courses. Without enrollment:
- Students don’t appear in course rosters
- Teachers can’t enter grades
- Students don’t see courses in timetable
- Courses don’t appear in student bulletins
Best Practices
Validation
- Always check for duplicate enrollments
- Verify student and course exist before creating
- Use composite primary key for database-level enforcement
User Experience
- Provide clear error messages for duplicates
- Show course and student names in listings
- Confirm before deleting enrollments
Data Integrity
- Use foreign key constraints
- Enable cascade deletion
- Keep historical grade data even after unenrollment
Security
- Restrict enrollment operations to admins only
- Validate all input data
- Use prepared statements for all queries