Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
Marketplace Operations SQL Analysis
00:00
5 left

Marketplace Operations SQL Analysis

HardSQL · PostgreSQL

Problem

Write a SQL query to analyze marketplace operations performance by joining expert activity, user demand, and resolution tables, then calculate daily response time and completion rate by region. Use all demand records, including records without an expert response or resolution. Treat the first response event as the response time and report completion rate as a decimal from 0 to 1.

Output

  1. One row per demand date and region, including regions with no response.
  2. Return region, demand_date, demand_count, responded_count, avg_response_hours, completed_count, completion_rate, and previous_day_completion_rate.
  3. Sort by region, then demand_date ascending.

Schema

user_demand
ColumnTypeDescription
demand_idPKINTUnique marketplace demand record
user_idINTUser who submitted the demand
expert_idINTAssigned expert identifier
regionVARCHAR(50)User demand region
requested_atTIMESTAMPTimestamp when the demand was submitted
expert_activity
ColumnTypeDescription
activity_idPKINTUnique expert activity record
demand_idINTRelated user demand
expert_idINTExpert performing the activity
activity_typeVARCHAR(30)Activity classification
activity_atTIMESTAMPTimestamp of the activity
resolution
ColumnTypeDescription
resolution_idPKINTUnique resolution record
demand_idINTRelated user demand
resolution_statusVARCHAR(30)Current resolution status
resolved_atTIMESTAMPTimestamp when the demand was resolved
Tablesuser_demandexpert_activityresolution
Interviewer

Your question is Marketplace Operations SQL Analysis. 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
You need to log in / sign up to run or submit.Ln 1
Run your query to see results here.