Annual Pass Available: Save up to 70%

The Cleanest Way to Get Interview-Ready in SQL, Python, and R

Structured practice, realistic datasets, and focused execution loops to help you perform with clarity in technical interviews.

230+

Interview-style coding questions

23+

Company-focused question sets

4

Practice engines: Postgres, MySQL, Python, R

March 2026 Leaderboard

User Score
#1 Ranked user: Blake
Blake Gold
105 pts
#2 Ranked user: Sydney
Sydney Silver
66 pts
#3 Ranked user: Greg
Greg Bronze
60 pts
#4 Ranked user: Deeptarka
Deeptarka
56 pts
#5 Ranked user: 421
421
55 pts
#6 Ranked user: Juan Andrés
Juan Andrés
50 pts
#7 Ranked user: shweta
shweta
47 pts
#8 Ranked user: Michaela
Michaela
42 pts
#9 Ranked user: Marieke
Marieke
38 pts
#10 Ranked user: Margareta
Margareta
38 pts

Anonymous Playground

Try a Real Question Before You Sign Up

Run SQL, Python, or R directly on this page. You can practice this sample without logging in.

Question 118

Daily bookings in the US

  • Write a query to return the daily number of bookings (reservations) in July 2021 in the US.
  • If there is no booking, return 0.

Table 1: bookings

When someone makes a reservation on Airbnb.

  col_name    | col_type
--------------+-------------------
date          | date
booking_id    | bigint
listing_id    | bigint

Table 2: dates

Calendar dates from 01/01/2019 to 12/31/2025.

 col_name | col_type
----------+----------
 year     | smallint
 month    | smallint
 date     | date

Table 3: listings

When a new Airbnb listing is created in a country ('US', 'UK', 'JP', 'CA', 'AU', 'DE')

  col_name    | col_type
--------------+-------------------
listing_id    | bigint
country       | varchar(2)
created_dt    | date

Sample results

    date    | count
------------+-------
 2021-07-01 |    1
 2021-07-02 |    2
 2021-07-03 |    3
 2021-07-04 |    0
 2021-07-05 |    5

Official solution

POSTGRES
WITH us_bookings AS (
    SELECT
        B.date,
        COUNT(booking_id) AS num_bookings
    FROM bookings B	
    INNER JOIN listings L
    ON L.listing_id = B.listing_id
    AND L.country = 'US'	
    GROUP BY date	
)
SELECT 
    D.date, 
    CASE WHEN B.num_bookings IS NULL THEN 0 ELSE B.num_bookings END AS num_bookings
FROM dates D
LEFT JOIN us_bookings B
ON B.date = D.date
WHERE D.date >= '2021-07-01'
AND D.date < '2021-08-01'
ORDER BY D.date;
Explanation

This query is designed to count the number of bookings made in US listings for each date within the specified time range. It accomplishes this by first selecting all bookings made in US listings and grouping them by date. This subquery is named "us_bookings".

The main query then selects all dates within the specified time range and left joins them with the "us_bookings" subquery on the date field. This is done to ensure that all dates within the specified range are included in the result, even if there were no bookings made on that date.

The final select statement returns the date and the number of bookings made on that date, with a case statement to handle cases where there were no bookings made on a particular date.

The result is ordered by date.

Expected results

Expected results appear after you submit.

Learners on SQLPad target interviews at

Loading testimonials...

Value Calculator

Estimate Your ROI with SQLPad

Enter your current salary and compare potential compensation upside against your SQLPad plan investment.

Summary

SQLPad starts at only $79/mo

Estimated annual upside

$0/year

Estimated ROI

0%

This salary estimate is based on publicly available compensation data for data scientists at top U.S. tech firms. Outcomes vary by interview performance, location, and hiring urgency.

Data engineers and machine learning engineers often earn more, so ROI can be higher for engineering-focused roles.

Loading FAQ...

Ready to Begin

Practice Daily. Interview Better.

Use SQLPad consistently and turn interview prep into a structured system instead of a guessing game.