daily_sales table, the sum of revenue from daily_sales and the sum of signup_count from signups for the 7-day window ending on that day (inclusive). Days with no signups should be treated as zero for signup_count.Return
day: the day at the end of the 7-day windowrolling_7d_revenue: total revenue from daily_sales in the 7-day window ending on dayrolling_7d_signups: total signup_count from signups in the 7-day window ending on day
Results should be ordered by day ascending.Expected output
| day | rolling_7d_revenue | rolling_7d_signups |
|---|---|---|
| 2023-01-01 | 2255 | 33 |
| 2023-01-02 | 6396 | 94 |
| 2023-01-03 | 10578 | 155 |
First 3 of 42 rows your query should return. Your column aliases don't need to match.
daily_sales
| day | region | revenue | orders |
|---|---|---|---|
| 2023-01-01 | US | 550 | 11 |
| 2023-01-02 | US | 1010 | 20 |
| 2023-01-03 | US | 1020 | 20 |
| 2023-01-04 | US | 1030 | 21 |
| 2023-01-05 | US | 1040 | 21 |
signups
| day | signup_count |
|---|---|
| 2023-01-01 | 33 |
| 2023-01-02 | 61 |
| 2023-01-03 | 61 |
| 2023-01-04 | 62 |
| 2023-01-05 | 63 |
0 of 3 hints revealed
Submit an attempt first.