SQL JOIN Practice Problems

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 problem

JOIN problems

Problems found: 86

Reset filters
  • MediumPremium
    PostgreSQL · ClickHouse

    Total Purchases by Customer 1

    Magnit's marketing team is preparing a personalized offer for customer user_id = 1 and wants to know how much the customer has spent.

    Magnit
  • MediumPremium
    PostgreSQL · ClickHouse

    Daily Signups Over the Last 7 Days

    Every evening, Skypro's marketing team reviews daily signups on its landing page. They need to see days without signups as well as days with signups because gaps matter for the analysis.

    Skypro
  • MediumPremium
    PostgreSQL

    Restaurant Reservation Calendar

    You're a data analyst at Salt & Ember, a restaurant. The floor manager is planning staff shifts for September 2026 and needs a calendar showing the number of confirmed table reservations for each day…

  • MediumPremium
    PostgreSQL

    New and Changed Merchant Profiles

    You work at a payment service. Every day, a partner bank sends a complete snapshot of merchant profiles, which is loaded into merchant_updates. The current merchant directory is stored in merchants.

  • MediumPremium
    PostgreSQL

    Classifying Product Price Feed Rows

    You're a data engineer at an online store selling coffee-related products. Every morning, a supplier sends a price feed containing its full product assortment, stored in the price_feed table.

  • MediumPremium
    PostgreSQL

    Employees Outearning Their Bosses

    You're an HR analyst at TableTales, a restaurant group. The CFO is reviewing the pay structure and wants to identify pay inversions: employees whose monthly pay is higher than their direct manager's…

  • MediumPremium
    PostgreSQL

    Players With No Purchase History

    You're a product analyst for Beast Rush, a mobile game. The monetization team is launching a discounted starter offer and wants to show it only to players who have never converted: those who have not…

  • MediumPremium
    PostgreSQL

    Daily Revenue Report Grain

    You're an analyst for the FastFork bistro chain. The POS system records orders in the orders table, with each order tied to a restaurant and a date.

  • MediumPremium
    PostgreSQL

    Avoid Double-Counting Promotional Sales

    You're a data analyst at GoodCart, an online marketplace. Managers have uploaded lists of promotional products to promo_list multiple times, so the same product appears 2-3 times under different…

  • MediumPremium
    PostgreSQL

    Subscriber Counts Inflated by Service Joins

    You're an analyst at Baltline, a telecom operator. The subscribers table contains subscribers and their signup cities, services contains their subscribed services (a subscriber may have several, and…

  • MediumPremium
    PostgreSQL

    Include Hotels Without Bookings in the Report

    You're an analyst at Sunroute, a tour operator. The hotels table contains hotels in the company's partner network, while bookings stores reservations with check-in dates, statuses, and amounts.

What you will practice

  • Choose the right JOIN type for the expected result
  • Identify the keys that connect two or more tables
  • Keep unmatched records with LEFT JOIN when needed
  • Understand how JOIN conditions and WHERE filters interact

Common mistakes

  1. 1. A JOIN creates unexpected duplicates

    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.

  2. 2. A WHERE filter removes unmatched rows

    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.

  3. 3. The wrong columns are joined

    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.

  4. 4. INNER JOIN hides missing relationships

    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.

Theory and courses

Frequently asked questions

Can I practice SQL JOIN for free?

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.

Does the trainer show the correct JOIN query?

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.

When should I use LEFT JOIN instead of INNER JOIN?

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.

Why does my JOIN return more rows than expected?

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.

Do I need GROUP BY to solve JOIN problems?

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.