A Flight in Two Local Time Zones
You're an analyst at Skyline Pacific Airlines. All departure and arrival times are stored as absolute instants (timestamptz), but passengers see local airport times on their tickets.
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 problemYou're an analyst at Skyline Pacific Airlines. All departure and arrival times are stored as absolute instants (timestamptz), but passengers see local airport times on their tickets.
You're building a data warehouse for a tour operator. The hotels_dim directory uses SCD Type 1: it does not retain history, and new values overwrite old ones.
You manage the data warehouse for a restaurant group. Supplier terms are stored in menu_supplier_dim using SCD Type 2: each row is a version of the terms with valid_from and valid_to.
You're a data engineer at an insurance company. Claim records are loaded into claims_fact in near real time and reference policies by the business key policy_ref.
You're an analyst at WanderDeck, a travel platform. The content team wants to know which excursions take off immediately after being published.
You're a billing analyst at LinkWave, a telecom operator. The customer support team is getting a new subscriber screen with a "latest invoice" section showing the date, amount, and status of each…
You're an analyst at FreshMart, a supermarket chain. The mobile app team is building a category leaders section that displays up to three best-selling products under each category heading.
You're an HR analyst. The company has a list of mandatory courses that every employee must complete and a training log that records all attempts, covering both mandatory and optional courses.
You're an analyst at HaulRight, a logistics company. For each order, the warehouse records shipments in shipments (an order may ship in multiple batches), while accounting records invoices in…
You're an analyst at Medora, a private clinic. The patients table lists patients, and insurance_policies stores their policy history.
You're an analyst at Nordkey, a real estate agency. The listings table contains properties for sale, the viewings table records completed showings, and the offers table contains purchase offers.
You're an analyst at the energy utility Voltmark. The sites table contains service locations, meters contains the meters installed at those sites (a site may have several or none), and readings…
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.