Re-enrollment Rate Calculator
Beginner Mode
Objective
Write a SQL query to calculate the re-enrollment rate of students based on their consecutive term enrollments. The re-enrollment rate is defined as the percentage of students who have enrolled in two or more consecutive terms.
Additional information
Consecutive terms are identified by increasing term_ids without any gaps.
The result should be rounded to two decimal places.
Output the re-enrollment rate as a percentage.
The
enrollmentstable schema:Column Type student_id INT term_id INT course_id VARCHAR
Examples
Example 1:
Output:
Input:
| enrollments | ||
|---|---|---|
| course_id | student_id | term_id |
| CS101 | 1 | 101 |
| CS102 | 1 | 102 |
| CS103 | 1 | 103 |
| CS101 | 2 | 101 |
| CS103 | 2 | 103 |
| CS101 | 3 | 101 |
| CS101 | 4 | 101 |
| CS102 | 4 | 102 |
| re_enrollment_rate |
|---|
| 50 |
Code Environment
Sign in or try as guest to run your code.
Track
| Question | Difficulty | Company | Access |
|---|
Need more practice in this area? Explore more questions →
Google