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
ExperiencesCoaching
New
Practice
Mock InterviewsTimed interview simulations with feedbackSuccess 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
Get started
Join-Heavy SQL Practice
00:00
5 left

Join-Heavy SQL Practice

MediumSQL · PostgreSQL

Problem

Solve a set of join-heavy SQL questions under time pressure.

Using the supplied Airbnb host, listing, and reservation data, write a query that summarizes each host with at least one active listing. Include only confirmed reservations whose checkout dates fall in 2025. Hosts without qualifying reservations must still appear.

Output

  1. One row per host with at least one active listing.
  2. Columns: host_id, host_name, active_listing_count, reservation_count, gross_booking_value, and latest_checkout.
  3. Order by gross_booking_value descending, then host_id ascending.

Schema

hosts
ColumnTypeDescription
host_idPKINTUnique host identifier
host_nameVARCHAR(100)Display name of the host
listings
ColumnTypeDescription
listing_idPKINTUnique listing identifier
host_idINTHost who owns the listing
listing_nameVARCHAR(150)Listing title
is_activeBOOLEANWhether the listing is currently active
reservations
ColumnTypeDescription
reservation_idPKINTUnique reservation identifier
listing_idINTListing associated with the reservation
statusVARCHAR(20)Reservation status
checkout_dateDATEReservation checkout date
total_amountNUMERIC(10,2)Total reservation amount
Tableshostslistingsreservations
Interviewer

Your question is Join-Heavy SQL Practice. 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.