Your question is SQL Campaign Performance by Channel. 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.
Targetbase needs a channel-level performance view for campaigns launched during January 2025. Write a PostgreSQL query that summarizes campaign delivery and business outcomes by marketing channel.
2025-01-01 through 2025-01-31.channel and include the number of distinct campaigns, impressions, clicks, conversions, spend, and revenue.| Column | Type | Description |
|---|---|---|
| campaign_idPK | INTEGER | Unique campaign identifier |
| campaign_name | VARCHAR(100) | Campaign name |
| channel | VARCHAR(50) | Marketing channel |
| status | VARCHAR(20) | Campaign lifecycle status |
| launched_at | DATE | Campaign launch date |
| Column | Type | Description |
|---|---|---|
| event_idPK | INTEGER | Unique event record identifier |
| campaign_id | INTEGER | References campaigns.campaign_id |
| event_type | VARCHAR(30) | Event classification |
| impressions | INTEGER | Delivered impressions |
| clicks | INTEGER | Recorded clicks |
| conversions | INTEGER | Attributed conversions |
| spend | NUMERIC(12,2) | Media spend |
| revenue | NUMERIC(12,2) | Attributed revenue |