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
Weekly Search to Booking Conversion
00:00
5 left

Weekly Search to Booking Conversion

MediumSQL · PostgreSQL

Problem

Given a table of therapist availability and patient searches, write a query to calculate the weekly conversion rate of searches to booked appointments. Count only searches made for a therapist marked available on the search date. A search is converted when it has an appointment with status booked.

Output

  1. One row per week, with weeks starting on Monday.
  2. Columns: week_start, search_count, booked_search_count, and conversion_rate.
  3. Express conversion_rate as a percentage rounded to two decimal places, ordered by week_start ascending.

Schema

therapist_availability
ColumnTypeDescription
availability_idPKINTUnique availability record identifier
therapist_idINTTherapist offering availability
available_dateDATEDate on which the therapist is available
patient_searches
ColumnTypeDescription
search_idPKINTUnique patient search identifier
patient_idINTPatient who performed the search
therapist_idINTTherapist viewed or selected by the patient
searched_atTIMESTAMPTimestamp when the search occurred
appointments
ColumnTypeDescription
appointment_idPKINTUnique appointment identifier
search_idINTSearch that led to the appointment
appointment_statusVARCHAR(20)Appointment outcome, such as booked or cancelled
appointment_dateDATEScheduled appointment date
Tablestherapist_availabilitypatient_searchesappointments
Interviewer

Your question is Weekly Search to Booking Conversion. 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.