HelloFresh marketing teams need a monthly view of campaign performance across acquisition channels. Write a PostgreSQL query that combines campaign metadata with daily campaign metrics.
Unknown.NULL when a ratio cannot be calculated.campaign_month, channel, total_impressions, total_clicks, total_conversions, total_spend, total_revenue, ctr_pct, conversion_rate_pct, roas.campaign_month as YYYY-MM.2025-01-01 inclusive through 2025-04-01 exclusive.ctr_pct, conversion_rate_pct, and roas to two decimal places, expressing the first two as percentages.channel ascending.NULL metric totals when all contributing values are NULL rather than converting them to zero.| Column | Type | Description |
|---|---|---|
| campaign_idPK | INT | Unique campaign identifier |
| campaign_name | VARCHAR(100) | HelloFresh campaign name |
| channel | VARCHAR(50) | Marketing acquisition channel |
| Column | Type | Description |
|---|---|---|
| metric_idPK | INT | Unique daily metric identifier |
| campaign_id | INT | References campaigns.campaign_id |
| metric_date | DATE | Date represented by the metrics |
| impressions | INT | Number of delivered impressions |
| clicks | INT | Number of campaign clicks |
| conversions | INT | Number of attributed conversions |
| spend | DECIMAL(10,2) | Advertising spend |
| revenue | DECIMAL(10,2) | Attributed revenue |