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
SQL for Journey Friction
00:00
5 left

SQL for Journey Friction

HardSQL · PostgreSQL

Problem

JPMorganChase wants to monitor customer journeys across its mobile app, website, branches, and contact center. Write a PostgreSQL query that aggregates January 2025 interactions for active customers and identifies journey stages with meaningful friction.

An interaction is considered a failure when its status is anything other than success. A friction point must have at least two interactions and a failure rate of at least 40%.

Requirements

  1. Join customers, interactions, and journey stages.
  2. Aggregate total interactions, distinct customers, failed interactions, failure rate, and average duration by channel and journey stage.
  3. Return only qualifying friction points, ranked by failure rate within each journey stage.
  4. Sort the final output by failure rate descending, stage order, and channel.

Schema

customers
ColumnTypeDescription
customer_idPKINTUnique customer identifier
customer_nameVARCHAR(100)Customer display name
segmentVARCHAR(30)Customer segment
is_activeBOOLEANWhether the customer is currently active
interactions
ColumnTypeDescription
interaction_idPKINTUnique interaction identifier
customer_idINTCustomer associated with the interaction
channelVARCHAR(30)Interaction channel
stage_codeVARCHAR(30)Journey stage code
interaction_tsTIMESTAMPInteraction timestamp
statusVARCHAR(20)Interaction outcome
duration_secondsINTInteraction duration in seconds
journey_stages
ColumnTypeDescription
stage_codePKVARCHAR(30)Unique journey stage code
stage_nameVARCHAR(80)Readable journey stage name
stage_orderINTBusiness order of the journey stage
Tablescustomersinteractionsjourney_stages
Interviewer

Your question is SQL for Journey Friction. 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.