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

Search-to-Booking Conversion Rate

MediumSQL · PostgreSQL

Problem

Given a table of user search queries and a table of bookings, write a query to calculate the search-to-book conversion rate per day for Expedia Group. A booking counts as a conversion when it references a search through search_id; attribute it to the search date, regardless of the booking date. Exclude searches without a valid timestamp.

Output

  1. One row per search date, including dates with zero conversions.
  2. Columns: search_date, total_searches, converted_searches, and conversion_rate.
  3. Order by search_date ascending. Return the rate as a decimal rounded to four places.

Schema

user_searches
ColumnTypeDescription
search_idPKINTUnique identifier for a user search event
user_idVARCHAR(50)Identifier of the user who performed the search
searched_atTIMESTAMPTimestamp when the search occurred
query_textVARCHAR(255)Search text entered by the user
bookings
ColumnTypeDescription
booking_idPKINTUnique identifier for a booking
search_idINTSearch event that led to the booking
booked_atTIMESTAMPTimestamp when the booking was created
booking_statusVARCHAR(20)Current booking status
Tablesuser_searchesbookings
Interviewer

Your question is Search-to-Booking Conversion Rate. Start with the requirements and the two 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.