Your question is Rolling Cohort Default Rate SQL. Start with the requirements and the three 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.
Forward Financing wants to monitor credit performance for its most recently funded merchant cohort. Write a PostgreSQL query that calculates the rolling 30-day default rate for that cohort.
funded_at value.| Column | Type | Description |
|---|---|---|
| merchant_idPK | INTEGER | Unique merchant identifier |
| merchant_name | VARCHAR(120) | Merchant business name |
| segment | VARCHAR(40) | Merchant segment |
| Column | Type | Description |
|---|---|---|
| funding_event_idPK | INTEGER | Unique funding event identifier |
| merchant_id | INTEGER | Merchant receiving funding |
| funded_at | TIMESTAMP | Timestamp when the funding event occurred |
| funded_amount | NUMERIC(12,2) | Amount funded |
| Column | Type | Description |
|---|---|---|
| default_event_idPK | INTEGER | Unique default event identifier |
| merchant_id | INTEGER | Merchant associated with the default |
| defaulted_at | TIMESTAMP | Timestamp when the default was recorded |
| default_reason | VARCHAR(80) | Reason recorded for the default |