Write a SQL query to find the top categories by repeat purchase rate.
Use completed purchases only. A repeat customer is a customer with at least two completed purchases in the same category. Ignore purchases with a NULL category_id or customer_id, and exclude categories with no qualifying customers.
category_id, category_name, repeat_purchase_rate_pct, purchasing_customers, repeat_customers, and category_rank.| Column | Type | Description |
|---|---|---|
| category_idPK | INT | Unique product category identifier |
| category_name | VARCHAR(50) | Product category name |
| Column | Type | Description |
|---|---|---|
| purchase_idPK | INT | Unique purchase identifier |
| category_id | INT | Referenced product category |
| customer_id | INT | Customer who made the purchase |
| status | VARCHAR(40) | Purchase processing status |