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
Users Did A But Not B
00:00
5 left

Users Did A But Not B

MediumSQL · PostgreSQL

Problem

Networth wants to identify users who viewed the Networth dashboard but did not connect a bank account during the same seven-day reporting period. Write a PostgreSQL query for the reporting period ending 2025-02-16.

For this task, action A is viewed_dashboard and action B is connected_bank_account.

Requirements

  1. Consider events from 2025-02-10 through 2025-02-16, inclusive.
  2. Return users who performed action A at least once and action B zero times during that period.
  3. Include users with no events only when they do not qualify, and return user_id and email ordered by user_id.

Schema

users
ColumnTypeDescription
user_idPKINTEGERUnique Networth user identifier
emailVARCHAR(255)User email address
signup_dateDATEDate the user registered
user_actions
ColumnTypeDescription
action_idPKINTEGERUnique action event identifier
user_idINTEGERReferences users.user_id
action_nameVARCHAR(50)Name of the action performed
occurred_atTIMESTAMPTimestamp when the action occurred
Tablesusersuser_actions
Interviewer

Your question is Users Did A But Not B. Start with the requirements and the two 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.