Your question is 7-Day Rolling Transactions. Start with the requirements and the two tables 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.
Featurespace's ARIC Risk Hub analyzes transaction activity by user. Write a PostgreSQL query that calculates a 7-day rolling average of daily transaction counts for each active user during the reporting period from 2024-01-01 through 2024-01-10.
| Column | Type | Description |
|---|---|---|
| user_idPK | INTEGER | Unique user identifier |
| user_name | VARCHAR(100) | User display name |
| risk_segment | VARCHAR(30) | Featurespace risk classification |
| VARCHAR(150) | Contact email |
| Column | Type | Description |
|---|---|---|
| transaction_idPK | INTEGER | Unique transaction identifier |
| user_id | INTEGER | User associated with the transaction |
| transaction_timestamp | TIMESTAMP | Transaction event timestamp |
| channel | VARCHAR(30) | Transaction channel |
| amount | NUMERIC(12,2) | Transaction amount |