Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
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 feedbackSuccess 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
Checkout Funnel Drop-Off Query
00:00
5 left

Checkout Funnel Drop-Off Query

MediumSQL · PostgreSQL

Problem

Given a table of user web sessions, write a query to identify the drop-off rate at each stage of the checkout funnel for Wayfair.

Use all sessions in the table. Treat a session as reaching a stage when its corresponding flag is true. Calculate each stage's drop-off rate relative to the immediately preceding stage.

Output

  1. One row per funnel stage, ordered from landing through purchase
  2. Columns: stage_name, sessions_reaching_stage, drop_off_rate
  3. Return NULL for the first stage's drop-off rate

Schema

web_sessions
ColumnTypeDescription
session_idPKINTUnique identifier for a web session
user_idINTWayfair customer identifier when available
source_channelVARCHAR(30)Marketing or traffic source for the session
viewed_productBOOLEANWhether the session viewed a product
added_to_cartBOOLEANWhether the session added an item to cart
started_checkoutBOOLEANWhether the session started checkout
entered_paymentBOOLEANWhether the session reached payment
completed_orderBOOLEANWhether the session completed an order
Tablesweb_sessions
Interviewer

Your question is Checkout Funnel Drop-Off Query. Start with the requirements and the one table 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.