Write a SQL query using window functions to identify overlapping insurance policy coverage periods for a single claimant.
Use the insurance_policies table and evaluate claimant 101. Coverage periods are inclusive, so a policy starting on the same date another policy ends is overlapping. Treat chained overlaps as one overlapping group.
claimant_id, overlap_group, policy_id, policy_number, coverage_start, coverage_end, and overlap_count.coverage_start, coverage_end, then policy_id.| Column | Type | Description |
|---|---|---|
| policy_idPK | INT | Unique identifier for the policy |
| claimant_id | INT | Identifier of the claimant covered by the policy |
| policy_number | VARCHAR(30) | External insurance policy reference |
| coverage_start | DATE | Inclusive start date of coverage |
| coverage_end | DATE | Inclusive end date of coverage |