Pilot of the Flight with the Second-Highest Passenger Count
Airline analysts are looking for the flight with the second-highest passenger count. Find the flight with the second-highest passengers value among all flights.
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: 110
Reset filtersAirline analysts are looking for the flight with the second-highest passenger count. Find the flight with the second-highest passengers value among all flights.
The delivery department is preparing a contact list with addresses. For every person in the Person table, return their first and last names, along with their city and state from the Address table.
Find customers who have never placed an order. Return their names in a result column named customers.
Return the name and bonus of each employee whose bonus is less than 1000. Include employees who have no bonus, too.
Alfa-Bank is analyzing customer purchases at partner stores. The marketing team wants to understand the demographics of smartwatch buyers so it can offer them gadget insurance.
Domclick maintains a geographic directory for regional landing pages and property searches, structured as country → region → city. Use it to find the country where the city of Salzburg is located.
Domclick is preparing a regional B2B real estate market report, which Sber uses to distribute property listings.
In a Yandex Practicum mini-project involving a stationery store, you need to determine the price category of each purchased product.
Cian uses a practice library schema to prepare for real-world tasks involving property listings. This exercise tests your ability to join tables, group rows, and filter groups.
Skypro's curriculum team wants to show only courses with enough reviews for a reliable rating on the landing page. Include only published courses (is_published = TRUE).
The accounting team is calculating quarterly bonuses and wants to see how much revenue each pharmacist generated.
Before updating membership statuses for the new season, the loyalty program coordinator wants to see how many miles each active member has accumulated.
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.