


Rippling's growth team launched a campaign in Rippling Spend on 2024-02-15 and wants a quick before-vs-after performance read. Write a SQL query to compare daily campaign performance for the periods before and after launch.
campaign_events table.Before Launch and After Launch.total_impressionstotal_clickstotal_signupsctr = total_clicks / total_impressionssignup_rate = total_signups / total_clicksevent_date is between 2024-02-08 and 2024-02-21 inclusive.2024-02-15 as Before Launch, and dates on or after 2024-02-15 as After Launch.period so After Launch appears first.| column | type | description |
|---|---|---|
| event_id | INT | Primary key for each daily campaign record |
| event_date | DATE | Date of campaign activity |
| campaign_name | VARCHAR(100) | Campaign name in Rippling Spend |
| impressions | INT | Number of impressions recorded that day |
| clicks | INT | Number of clicks recorded that day |
| signups | INT | Number of signups attributed that day |
| channel | VARCHAR(50) | Marketing channel |
| event_id | event_date | campaign_name | impressions | clicks | signups | channel |
|---|---|---|---|---|---|---|
| 1 | 2024-02-12 | Spend Launch | 1000 | 45 | 6 | Paid Search |
| 2 | 2024-02-08 | Spend Launch | 800 | 32 | 4 | Paid Social |
| 3 | 2024-02-16 | Spend Launch | 1500 | 90 | 15 | Paid Search |
| 4 | 2024-02-14 | Spend Launch | 950 | 40 | 5 | |
| 5 | 2024-02-18 | Spend Launch | 1700 | 102 | 18 | Paid Social |
| 6 | 2024-02-21 | Spend Launch | 1600 | 88 | 14 |
| period | total_impressions | total_clicks | total_signups | ctr | signup_rate |
|---|---|---|---|---|---|
| After Launch | 7400 | 430 | 70 | 0.0581 | 0.1628 |
| Before Launch | 4400 | 177 | 21 | 0.0402 | 0.1186 |
| Column | Type | Description |
|---|---|---|
| event_idPK | INT | Primary key for each daily campaign record |
| event_date | DATE | Date of campaign activity |
| campaign_name | VARCHAR(100) | Campaign name in Rippling Spend |
| impressions | INT | Number of impressions recorded that day |
| clicks | INT | Number of clicks recorded that day |
| signups | INT | Number of signups attributed that day |
| channel | VARCHAR(50) | Marketing channel |
{"campaign_events":[["1","2024-02-12","Spend Launch","1000","45","6","Paid Search"],["2","2024-02-08","Spend Launch","800","32","4","Paid Social"],["3","2024-02-16","Spend Launch","1500","90","15","Paid Search"],["4","2024-02-14","Spend Launch","950","40","5","Email"],["5","2024-02-18","Spend Launch","1700","102","18","Paid Social"],["6","2024-02-21","Spend Launch","1600","88","14","Email"],["7","2024-02-10","Spend Launch","1100","60","6",null],["8","2024-02-15","Spend Launch","1200","70","10","Output[["After Launch","12754","695","118","0.0545","0.1698"],["Before Launch","10078","476","73","0.0472","0.1534"]]