Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Find Users Missing Follow-Up Action

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

Welcome to the SQL screen.

The question is on your right: Find Users Missing Follow-Up Action. Read through the requirements and the two 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 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