Write a PostgreSQL query that ranks active customers by the number of support incidents. Return each active customer's name, total incident count, count of high-severity incidents, most recent incident date, and rank. Customers with the same total incident count should share the same rank.
| Column | Type | Description |
|---|---|---|
| customer_id | ||
| customer_name | ||
| account_status | ||
| industry |
| Column | Type | Description |
|---|---|---|
| incident_id | ||
| customer_id | ||
| product_name | ||
| severity | ||
| opened_at |
One row per active customerInclude customers with zero incidentsUse a ranking window function on total incidentsOrder by rank, then customer name