Your question is 7-Day Running Total SQL. Start with the requirements and the one table on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Highmark Health analysts need a daily view of enrollment activity to monitor short-term changes across coverage operations. The enrollment source may contain missing dates, so the rolling calculation must use calendar days rather than simply counting the previous seven rows.
Write a PostgreSQL query that calculates the 7-day running enrollment total for January 1 through January 10, 2025.
enrollment_date, the daily enrollment count, and running_7_day_total.NULL daily count, treating them as zero in the total.| Column | Type | Description |
|---|---|---|
| enrollment_datePK | DATE | Date of enrollment activity |
| enrollment_count | INTEGER | Number of enrollments recorded on the date |