Khan Academy wants to monitor learner engagement across grade levels. Write a PostgreSQL query that calculates the daily number of distinct active learners for each grade level and a seven-day rolling average of that count from January 1 through January 10, 2025.
grade_level and activity_date.| Column | Type | Description |
|---|---|---|
| learner_idPK | INTEGER | Unique learner identifier |
| learner_name | VARCHAR(100) | Learner display name |
| grade_level | VARCHAR(20) | Learner's grade level |
| Column | Type | Description |
|---|---|---|
| activity_idPK | INTEGER | Unique activity event identifier |
| learner_id | INTEGER | Learner associated with the activity event |
| activity_date | DATE | Date of the activity |
| activity_type | VARCHAR(50) | Type of Khan Academy activity |