Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Cohort Conversion Before vs After

HardSQL · PostgreSQL00:00
Practice interviewer
In session
5 left
00:00

Your question is Cohort Conversion Before vs After. Start with the requirements and the three 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.

You need to log in / sign up to run or submit.

Problem

Santander wants to evaluate the impact of a campaign promoting the Santander Edge current account. Write a PostgreSQL query that compares each customer signup cohort's conversion rate during the 30 days before campaign exposure with the 30 days after exposure.

Requirements

  1. Consider only participants in Santander Edge Spring 2024.
  2. Define conversion as at least one approved application for the Santander Edge account in the relevant 30-day period.
  3. Return one row per signup cohort with cohort size, before and after conversion counts, conversion rates, and the percentage-point lift after the campaign.
  4. Use a left join for applications so customers without applications remain in the denominator. Order by cohort month.

Schema

customers
ColumnTypeDescription
customer_idPKINTUnique Santander customer identifier
customer_nameVARCHAR(100)Customer name
signup_dateDATEDate the customer signed up
campaign_participants
ColumnTypeDescription
customer_idPKINTCustomer exposed to a campaign
campaign_nameVARCHAR(150)Campaign name
campaign_start_dateDATEDate used as the campaign exposure boundary
campaign_channelVARCHAR(30)Channel through which the campaign was delivered
applications
ColumnTypeDescription
application_idPKINTUnique product application identifier
customer_idINTCustomer who submitted the application
application_dateDATEDate the application was submitted
approvedBOOLEANApplication approval status
product_nameVARCHAR(100)Product requested in the application
Tablescustomerscampaign_participantsapplications
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results