Total Cost of Each Completed Reservation
The hotel chain's accounting department needs a breakdown of every completed reservation, showing both the base cost of the stay and the final amount including additional services.
Practice SQL JOIN with problems that go beyond matching two tables. Work with customers, orders, employees, and other related data to find records, combine information, and calculate results. Your queries run in a real database and are automatically checked against expected results using hidden data. Problems in this set: 148, free: 26.
Problems in this set: 148, free: 26
Start with a free problemProblems found: 88
Reset filtersThe hotel chain's accounting department needs a breakdown of every completed reservation, showing both the base cost of the stay and the final amount including additional services.
The risk management team is analyzing how the time to maturity of the bank's portfolio changes from 2024-12-01 through 2024-12-03.
A pizza chain is offering a fixed price for any pizza with three toppings. From the list of available toppings, generate every unique combination of three different toppings.
Airbnb's recommendation team is looking for pairs of rental properties that share amenities.
Captains need a report on the last guest for each cabin in case they need to contact that person after the trip.
The finance department tracks drivers' cumulative earnings. For each ride, return the driver's name (name), the ride date (ride_date — cast started_at to a date), and the total income from all of…
The library’s outreach team wants to feature the three most recent book checkouts across the entire library.
Management needs a summary of developer workloads. For each developer, count the assigned projects (project_count). Include developers with no projects and show a count of zero for them.
A ride-hailing service is preparing a trip quality report for October 1 through October 3, 2013.
An analyst wants to identify categories that appeal to the same customers to improve cross-selling and recommendations.
An educational platform is analyzing which courses students most often take together. Find the pair of courses taken together by the largest number of students.
Before updating the user dimension, you need to identify which records have actually changed.
When one customer has several orders, joining the tables produces several rows for that customer. This can inflate counts and sums. Check whether the join keys are unique on either side, and compare the number of rows before and after the JOIN.
A LEFT JOIN fills columns from the missing right-hand record with NULL. Filtering those columns in WHERE can remove the unmatched rows you intended to keep. Check whether records without matches are still present, and decide whether the condition belongs in ON or WHERE.
Two columns with similar names are not necessarily related. Joining them can produce no matches or, worse, convincing but incorrect pairs of records. Check what each key represents, whether the data types are compatible, and whether a few known relationships appear correctly in the result.
INNER JOIN returns only matching records. If the problem asks for customers without orders or pages without likes, those rows will disappear. Before writing the query, decide whether unmatched records belong in the output. Test your choice using records that have no corresponding row.
Yes. Free problems in this set: 26. You can solve them without paying. After signing in, the free plan allows up to 3 new problems per day. Premium problems are visible in the list but require a subscription to solve.
Reference solutions are not published. You write your own SQL, which runs against a real database. The trainer automatically checks the result against an expected result using hidden data. Problems include hints and an AI mentor to help you work through the logic.
Think about which rows must appear in the result. Use LEFT JOIN when every row from the left table should remain, even without a matching record on the right. INNER JOIN is appropriate when you only need matches. The difference becomes clear when you test missing relationships.
The relationship may be one-to-many or many-to-many. A single row from one table can match several rows in another, producing multiple output rows. That is not always a mistake. First decide whether the problem expects every matching pair or one result per entity.
Not always. Some problems only require connecting tables and selecting the right records. Others ask you to count related rows, calculate totals, or summarize the joined data. Start with straightforward joins, then move to problems that combine JOIN with aggregation.