Dataford
Interview QuestionsInterview GuidesExperiencesCoaching
New
Pricing
Get started
Dataford
Popular roles
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Browse
Browse All RolesEvery role hub, from analyst to MLBrowse All CompaniesCompany-specific interview loopsAll Interview GuidesThe full guide library
Top questions by role
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Top questions by skill
SQLPythonStatisticsMachine LearningA/B TestingSystem DesignGenerative AIProduct SenseMetricsBehavioral
Browse all questions →Try a mock interview
Experiences
Practice
Mock InterviewsTimed interview simulations with feedbackCoaching1:1 coaching with people at your target companiesSuccess PathYour 6-week structured planModulesCurated lessons by topicWebinarsTalks from ex-Big Tech data leadsPlaygroundA free-form scratch editor
Learn
BlogInterview strategy and career adviceTech Job Market ReportHiring trends across data and AI rolesFor UniversitiesDataford for career centersAbout DatafordWho we are and how we build
Pricing
Build my plan
Invite Behavior and User Retention
00:00
5 left

Invite Behavior and User Retention

HardSQL · PostgreSQL

Problem

You are given the task of measuring whether users who invite teammates in Asana are more likely to retain. Write a SQL query that groups users by whether they sent at least one teammate invite within 7 days of signup, then calculates each group’s 30-day retention rate. Treat a user as retained if they have at least one activity event on or after day 30 and on or before day 60 after signup. Return the invite cohort, total users, retained users, and retention rate, ordered by the invite cohort.

Schema

users
ColumnTypeDescription
user_idPKINTUnique user identifier
signup_dateDATEDate the user signed up for Asana
plan_tierVARCHAR(20)Plan tier at signup
country_codeVARCHAR(2)Two-letter country code
invites
ColumnTypeDescription
invite_idPKINTUnique invite identifier
inviter_user_idINTUser who sent the teammate invite
invitee_emailVARCHAR(255)Email address invited to join
sent_atDATEDate the invite was sent
activity_events
ColumnTypeDescription
event_idPKINTUnique event identifier
user_idINTUser who generated the activity event
event_dateDATEDate of the activity event
event_nameVARCHAR(50)Type of activity event in Asana
Tablesusersinvitesactivity_events
Interviewer

Your question is Invite Behavior and User Retention. Start with the requirements and the three tables in the Question tab.

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.
CodePostgreSQL
Sign up free to run your codeLog inLn 1
Run your query to see results here.