Product Pairs Frequently Bought Together
A recommendation engine analyzes co-purchases to find products worth suggesting together.
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: 148
Reset filtersA recommendation engine analyzes co-purchases to find products worth suggesting together.
A transportation company wants to recognize drivers whose average fuel efficiency is higher than the average across all trips.
A book review site wants to find books that provoke widely different reactions from readers. Find books whose highest and lowest review ratings differ by at least 3. Return book_id and title.
The analytics team is preparing a report showing how many orders with status = 'paid' each user has. The current report omits users without paid orders, even though they matter for the analysis.
Step 5 of 5 in the payment incident investigation: check the reverse scenario. Find orders with status = 'pending' that already have at least one payment with status = 'success'.
The CRM team is planning a reactivation campaign for users who have never had a paid order. Find users with no orders where status = 'paid', including users who have never placed an order.
A product dashboard needs to show the revenue generated by every user in a_users. For each user, sum amount from a_events, counting only events with kind = 'purchase'.
The CRM team wants to know how many days it takes new users to make their first purchase after signing up.
Ozon's HR analytics team is looking for compensation anomalies—cases where an active employee earns more than their direct manager.
MegaFon's financial reporting requires all foreign-currency transactions to be converted to rubles.
At ivi, content can be subscription-based (SVOD), ad-supported (AVOD), or pay-per-view (TVOD). The product analytics team needs daily view counts over the last 30 days for two target platforms.
As part of its engineering challenge days, Cian tests engineers' ability to find orphaned records—a problem that also occurs in production when a child record refers to a parent that no longer exists.
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.