Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

SQL for Journey Friction

HardSQL · PostgreSQL00:00
Practice interviewer
In session
5 left
00:00

Your question is SQL for Journey Friction. Start with the requirements and the three 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

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
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results