Write a SQL query to analyze campaign performance by advertiser, including spend, impressions, clicks, CTR, and conversion rate over the last 30 days.
Use the provided advertisers and campaign_daily_metrics tables. CTR and conversion rate should be percentages, with zero returned when the denominator is zero.
advertiser_id, advertiser_name, total_spend, total_impressions, total_clicks, ctr, conversion_rate.total_spend descending, then advertiser_id ascending.| Column | Type | Description |
|---|---|---|
| advertiser_idPK | INT | Unique advertiser identifier |
| advertiser_name | VARCHAR(120) | Advertiser display name |
| Column | Type | Description |
|---|---|---|
| metric_idPK | INT | Unique daily metric record identifier |
| advertiser_id | INT | Advertiser associated with the metric record |
| campaign_id | INT | Samsung Ads campaign identifier |
| metric_date | DATE | Date represented by the daily metrics |
| spend | NUMERIC(12,2) | Campaign spend in dollars |
| impressions | INT | Ad impressions |
| clicks | INT | Ad clicks |
| conversions | INT | Attributed conversions |