Your question is Running Totals and Moving Averages. 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.
TransUnion needs a customer-level view of credit utilization trends for analytics and risk monitoring. Write a PostgreSQL query that aggregates account snapshots by month, then uses window functions to calculate cumulative and rolling utilization metrics.
| Column | Type | Description |
|---|---|---|
| customer_idPK | INTEGER | Unique customer identifier |
| customer_name | VARCHAR(100) | Customer display name |
| Column | Type | Description |
|---|---|---|
| snapshot_idPK | INTEGER | Unique snapshot identifier |
| customer_id | INTEGER | Customer associated with the snapshot |
| snapshot_date | DATE | Date when the balance and limit were recorded |
| balance | NUMERIC(12,2) | Outstanding revolving balance |
| credit_limit | NUMERIC(12,2) | Total reported credit limit |