Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Compare ChatGPT Acquisition Performance

MediumSQL · PostgreSQL00:00
I
Practice interviewer
Your interviewer
In session
I
Interviewer

Welcome to the SQL screen.

The question is on your right: Compare ChatGPT Acquisition Performance. Read through the requirements and the four tables first.

Run and submit your code as often as you need. You also have five interviewer messages this session - want to talk through your approach, or are you ready to start coding?

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

Problem

At NovaNote, the growth team wants to compare users acquired through ChatGPT against users from all other acquisition channels. Write a PostgreSQL query to produce a cohort-style comparison for users who signed up in January 2024.

Requirements

  1. Classify each January signup into one of two segments:
    • ChatGPT if acquisition_channels.channel_name = 'ChatGPT'
    • Other for every other non-null channel
  2. For each segment, return:
    • total signed up users
    • activated users (at least one activation event within 7 days of signup)
    • purchasers (at least one paid order within 30 days of signup)
    • activation rate and purchase rate as percentages rounded to 2 decimals
  3. Exclude users whose channel_id is NULL
  4. Order results by segment name

Schema

users
ColumnTypeDescription
user_idPKINTUnique user identifier
signup_dateDATEDate the user created an account
channel_idINTAcquisition channel tied to the signup
country_codeVARCHAR(2)Two-letter country code
acquisition_channels
ColumnTypeDescription
channel_idPKINTUnique channel identifier
channel_nameVARCHAR(50)Name of the acquisition channel
events
ColumnTypeDescription
event_idPKINTUnique event identifier
user_idINTUser who generated the event
event_nameVARCHAR(50)Type of event
event_dateDATEDate the event occurred
orders
ColumnTypeDescription
order_idPKINTUnique order identifier
user_idINTUser who placed the order
order_dateDATEDate the order was placed
amount_usdDECIMAL(10,2)Order amount in USD
Tablesusersacquisition_channelseventsorders
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results