Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

7-Day Retention by Integration Signup

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

Your question is 7-Day Retention by Integration Signup. 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

Asana’s growth team wants to measure whether users acquired through a specific third-party integration come back one week after signup. Write a SQL query to calculate the 7-day retention rate for users who signed up through the Slack integration.

Requirements

  1. Identify users whose signup source is the Slack integration.
  2. Define a retained user as someone who has at least one activity event on the exact date that is 7 days after their signup date.
  3. Return the total number of Slack-signup users, the number retained on day 7, and the retention rate as a percentage rounded to 2 decimals.
  4. Exclude users with a NULL signup timestamp or NULL integration source.

Schema

users
ColumnTypeDescription
user_idPKINTUnique user identifier
signup_tsTIMESTAMPTimestamp when the user signed up for Asana
workspace_idINTWorkspace joined at signup
integration_signups
ColumnTypeDescription
signup_idPKINTUnique integration signup record
user_idINTUser associated with the integration signup
integration_nameVARCHAR(50)Integration credited for acquisition
connected_tsTIMESTAMPTimestamp when the integration was connected
user_events
ColumnTypeDescription
event_idPKINTUnique event identifier
user_idINTUser who performed the event
event_nameVARCHAR(50)Name of the user activity event
event_tsTIMESTAMPTimestamp when the event occurred
Tablesusersintegration_signupsuser_events
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results