Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Find Users Missing Follow-Up Action

MediumSQL · PostgreSQL00:00
I
Practice interviewer
In session
5 left
00:00

Your question is Find Users Missing Follow-Up Action. Start with the requirements and the two 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

At StreamForge, product analysts want to identify users who completed action A but did not complete action B within the next 24 hours. Write a PostgreSQL query to return those users.

Requirements

  1. Consider each A event independently.
  2. A user qualifies if they have at least one A event with no corresponding B event from the same user in the next 24 hours.
  3. Return each qualifying user once, along with the timestamp of the qualifying A event.
  4. Sort the result by a_timestamp ascending, then user_id ascending.

Schema

users
ColumnTypeDescription
user_idPKINTUnique user identifier
user_nameVARCHAR(100)User display name
signup_dateDATEDate the user signed up
events
ColumnTypeDescription
event_idPKINTUnique event identifier
user_idINTUser who performed the event
action_typeVARCHAR(10)Event type such as A, B, or other actions
event_timeTIMESTAMPTimestamp when the event occurred
Tablesusersevents
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results