Write a SQL query using window functions to identify the top three most active service professionals in each geographic market based on lead volume on Thumbtack.
Use active professionals and all available leads. Return exactly three professionals per market when at least three qualify, breaking equal lead volumes by professional ID.
market_name, professional_id, professional_name, lead_volume, and market_rank.market_name, market_rank, and professional_id.| Column | Type | Description |
|---|---|---|
| professional_idPK | INT | Unique service professional identifier |
| professional_name | VARCHAR(100) | Service professional's display name |
| market_name | VARCHAR(100) | Geographic market where the professional operates |
| is_active | BOOLEAN | Whether the professional is currently active |
| Column | Type | Description |
|---|---|---|
| lead_idPK | INT | Unique lead identifier |
| professional_id | INT | Professional associated with the lead |
| created_at | DATE | Date the lead was created |