Organic sign-ups during each campaign's run
The task
The growth team wants a rough sense of the background sign-up rate while each campaign ran. A campaign was live from started_on to ended_on, both days included. A NULL ended_on means it is still running, so it is live through the end of the data.
Count the organic sign-ups (signups.campaign_id IS NULL) whose sign-up date (the UTC date of signed_up_at) falls inside each campaign's live window. One organic sign-up can fall inside several campaigns' windows, and counts for each of them.
Return campaign_id and organic_signups, including campaigns with 0. Sort by campaign_id.
Expected output
campaign_idorganic_signups- Sorted by campaign_id ascending.
- Checked on the sample and on 2 hidden datasets. How grading works
Tables Marketing team · click a name to insert it
campaigns10 rows in the sample
One row per campaign. Key: campaign_id.
| int | Unique id. | |
| text | Name. | |
| text | search, social, video, email or affiliate. | |
| date | First day live. | |
| date | Last day live. NULL if still running. | |
| numeric(10,2) | Budget per day, USD. |
ad_daily969 rows in the sample
One row per campaign per day it served ads. Days with no delivery have no row. Key: campaign_id, day.
| int | The campaign. | |
| date | The day. | |
| int | Times an ad was shown. | |
| int | Clicks. | |
| numeric(10,2) | Money spent, USD. |
signups2,108 rows in the sample
One row per new user. campaign_id is the campaign credited with the sign-up. Key: user_id.
| int | Unique id. | |
| timestamp | When they signed up (UTC). | |
| int | Credited campaign. NULL for organic sign-ups. | |
| text | Two-letter country code. |
purchases2,294 rows in the sample
One row per paid order by a user. Key: purchase_id.
| int | Unique id. | |
| int | Buyer. | |
| timestamp | When (UTC). | |
| numeric(10,2) | Order value, USD. |
Related questions
- Daily spend against sign-ups for one campaignhard
- April spend and cost per click for search and socialeasy
- Invoiced amount by the plan active on the issue datemedium
- Open accounts at each month end, by account typehard
- Plays in the first two weeks for April joinerseasy
- Recurring revenue by plan on a given dayeasy
Loading the editor and PostgreSQL
Loading the editor and PostgreSQL