Your question is Rolling 30-Day Premium Average. 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.
Arthur J. Gallagher & needs a regional view of recent insurance premium activity. Write a PostgreSQL query that calculates the rolling 30-day average premium for each region using client and premium records.
insurance_premiums to clients using client_id.premium_date.NULL region group.| Column | Type | Description |
|---|---|---|
| client_idPK | INTEGER | Unique client identifier |
| client_name | VARCHAR(100) | Client name |
| region | VARCHAR(50) | Client operating region |
| Column | Type | Description |
|---|---|---|
| premium_idPK | INTEGER | Unique premium record identifier |
| client_id | INTEGER | References clients.client_id |
| premium_date | DATE | Date the premium was recorded |
| premium_amount | NUMERIC(12,2) | Premium amount in dollars |