Given this schema, write a query to identify the top 5 segments of students by enrollment volume at Southern New Hampshire University.
Count distinct active or completed enrollments in the 2024-2025 academic year, using the student's segment that was effective at the start of the enrollment term. Exclude canceled enrollments and segments with no qualifying enrollments.
segment_name and enrollment_volume| Column | Type | Description |
|---|---|---|
| term_idPK | INT | Unique academic term identifier |
| term_name | VARCHAR(50) | Display name of the academic term |
| academic_year | VARCHAR(20) | Academic year containing the term |
| term_start_date | DATE | First date of the academic term |
| Column | Type | Description |
|---|---|---|
| student_idPK | INT | Unique student identifier |
| student_type | VARCHAR(30) | Broad student classification |
| Column | Type | Description |
|---|---|---|
| student_segment_idPK | INT | Unique segment membership record |
| student_id | INT | Student assigned to the segment |
| segment_id | INT | Assigned student segment |
| effective_start_date | DATE | Date when the assignment begins |
| effective_end_date | DATE | Date when the assignment ends |
| Column | Type | Description |
|---|---|---|
| enrollment_idPK | INT | Unique enrollment identifier |
| student_id | INT | Student associated with the enrollment |
| term_id | INT | Academic term for the enrollment |
| enrollment_status | VARCHAR(20) | Current enrollment status |
| Column | Type | Description |
|---|---|---|
| segment_idPK | INT | Unique segment identifier |
| segment_name | VARCHAR(80) | Student segment name |