Your question is Channel Performance by Time in SQL. Start with the requirements and the two tables on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
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.| 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 |