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
SQL for Business Performance Metrics
00:00
5 left

SQL for Business Performance Metrics

HardSQL · PostgreSQL

Problem

Write a SQL query to analyze business performance at Tripadvisor by joining bookings, users, and support tickets, then aggregate key metrics by month and region. Include bookings and users with matching records, while preserving regions that have no support tickets. Use the booking month for monthly reporting and count each support ticket once.

Output

  1. One row per booking month and region, ordered by month ascending and region ascending.
  2. Columns: month, region, booking_count, total_booking_value, unique_users, support_ticket_count, and users_with_tickets.
  3. Include booking months and regions with zero support tickets.

Schema

users
ColumnTypeDescription
user_idPKINTUnique Tripadvisor user identifier
country_codeVARCHAR(2)Two-letter user country code
regionVARCHAR(40)Reporting region for the user
bookings
ColumnTypeDescription
booking_idPKINTUnique booking identifier
user_idINTUser who made the booking
booked_atDATEBooking date
amountNUMERIC(10,2)Booking value
support_tickets
ColumnTypeDescription
ticket_idPKINTUnique support ticket identifier
user_idINTUser who submitted the ticket
opened_atDATETicket creation date
statusVARCHAR(20)Current ticket status
Tablesbookingsuserssupport_tickets
Interviewer

Your question is SQL for Business Performance Metrics. 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.