Problem index

Browse every SQL practice problem.

Each problem has a crawlable detail page with schema, sample data, expected output, answer, explanation, common mistakes, and related concepts.

All problems

26 crawlable SQL problem pages

Use this index when you want a direct link to a specific problem page.

Intermediate #004

Count orders per customer

Return each customer_id and the number of orders placed by that customer.

GROUP BYStandard SQL
Intermediate #010

Label orders with CASE

Return each order id and a size label: High for orders of 100 or more, otherwise Standard.

SELECTMySQL
Beginner #020

Show a fallback display name

Return each user's id and display name. Use nickname when it exists, otherwise use name.

NULL HandlingStandard SQL
Advanced #021

Rank orders within each customer

Return each order with a rank number based on total_amount from highest to lowest within the same customer.

Window FunctionPostgreSQL
Intermediate #024

Find each employee's manager name

Return each employee name with the name of their manager, keeping employees who have no manager.

JOINStandard SQL