Write a query to find the top three highest-performing ad campaigns by monthly revenue, grouped by device type.
Use the campaign revenue records for each calendar month and device type. Return the top three campaigns within each month and device group, excluding records without a campaign or device type.
revenue_month, device_type, campaign_id, campaign_name, and monthly_revenue.| Column | Type | Description |
|---|---|---|
| campaign_idPK | INT | Unique campaign identifier |
| campaign_name | VARCHAR(150) | LG Ad Solutions campaign name |
| Column | Type | Description |
|---|---|---|
| revenue_idPK | INT | Unique revenue record identifier |
| campaign_id | INT | Referenced campaign identifier |
| device_type | VARCHAR(40) | Device category generating the revenue |
| revenue_month | DATE | Date associated with the revenue record |
| revenue | DECIMAL(12,2) | Revenue amount in USD |