Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Top Underperforming Regions by Conversion

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

Your question is Top Underperforming Regions by Conversion. Start with the requirements and the two 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

Walmart Labs Operations uses regional funnel metrics to monitor performance across its commerce network. Write a PostgreSQL query that identifies the five regions with the lowest conversion rates during the last completed calendar quarter.

Requirements

  1. Filter metrics to the last completed calendar quarter using PostgreSQL date functions.
  2. Aggregate sessions and conversions by region, treating NULL conversions as zero.
  3. Calculate conversion rate as total conversions divided by total sessions.
  4. Return the five lowest conversion rates, breaking ties alphabetically by region name. Exclude regions without recorded sessions.

Schema

regions
ColumnTypeDescription
region_idPKINTUnique regional identifier
region_nameVARCHAR(50)Walmart Labs operating region name
regional_funnel_metrics
ColumnTypeDescription
metric_idPKINTUnique metric record identifier
region_idINTReferenced operating region
metric_dateDATEDate covered by the metric record
sessionsINTNumber of customer sessions
conversionsINTNumber of completed conversions
Tablesregionsregional_funnel_metrics
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results