Write a SQL query using window functions to identify the top-performing media campaigns per region for each day.
Use the campaign and daily performance tables. Define performance as total revenue for a campaign on a given day. Exclude records without a region or revenue, and include ties.
region, campaign_date, campaign_id, campaign_name, total_revenue, and performance_rank.region, campaign_date, and campaign_id.| Column | Type | Description |
|---|---|---|
| campaign_idPK | INT | Unique media campaign identifier |
| campaign_name | VARCHAR(150) | Campaign display name |
| region | VARCHAR(100) | French operating region associated with the campaign |
| channel | VARCHAR(50) | Media channel used by the campaign |
| Column | Type | Description |
|---|---|---|
| stat_idPK | INT | Unique daily performance record identifier |
| campaign_id | INT | Campaign associated with the performance record |
| campaign_date | DATE | Date of the performance record |
| revenue | DECIMAL(12,2) | Revenue attributed to the campaign record |