Your question is Average Claims for Active Members. 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.
Aetna's claims reporting team needs the average claim amount submitted for members who had maintained active coverage for at least one year when each claim was submitted. Write a PostgreSQL query using the claims and members tables.
AVG should naturally ignore NULL claim amounts.| Column | Type | Description |
|---|---|---|
| member_idPK | INT | Aetna member identifier |
| member_name | VARCHAR(100) | Member's name |
| enrollment_date | DATE | Coverage start date |
| termination_date | DATE | Coverage end date, or NULL for ongoing coverage |
| Column | Type | Description |
|---|---|---|
| claim_idPK | INT | Claim identifier |
| member_id | INT | Member associated with the claim |
| claim_date | DATE | Date the claim was submitted |
| claim_amount | NUMERIC(12,2) | Billed claim amount |
| claim_type | VARCHAR(30) | Claim classification |