Re-enrollment Rate Calculator
Google ☯️ Medium SQLJoins
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 enrollments table schema:

    Column Type
    student_id INT
    term_id INT
    course_id VARCHAR

Examples

Example 1:

Input:

enrollments
course_idstudent_idterm_id
CS1011101
CS1021102
CS1031103
CS1012101
CS1032103
CS1013101
CS1014101
CS1024102

Output:
re_enrollment_rate
50
Quick Solution

Code Environment

Sign in or try as guest to run your code.

Sign In

Track

Question Difficulty Company Access
Need more practice in this area? Explore more questions →