Interactive SQL practice

Intermediate SQL Challenges

Work through 90 intermediate SQL exercises in a structured sequence. Each challenge includes a clear problem, schema context and an interactive query editor.

90 SQL challenges

Open Practice Arena
INNER JOIN
Intermediate

Revenue Per Customer

Calculate total revenue (sum of total_amount) per customer, showing customer name and total revenue, sorted by revenue descending. Return columns: customer_name, total_revenue. Order results by: total_revenue DESC.

INNER JOIN
Intermediate

Product Sales Summary

For each product, show the total quantity sold and total revenue from order_items. Include product name. Return columns: product_name, total_quantity, total_revenue. Order results by: total_revenue DESC.

Date Functions
Intermediate

Employee Hire Year Count

Count how many employees were hired in each year, ordered by year ascending. Return columns: hire_year, employee_count. Order results by: hire_year ASC.

INNER JOIN
Intermediate

Department Payroll Summary

Show each department name, employee count, and total payroll. Return columns: department_name, employee_count, total_payroll. Order results by: d.id.

LEFT JOIN
Intermediate

Department Employee Coverage

Show all departments and their employee count, including departments with no employees. Return columns: department_name, employee_count. Order results by: d.id.

GROUP BY
Intermediate

Order Status Summary

Show the order count and total amount for each status. Return columns: status, order_count, total_amount. Order results by: status.

HAVING
Intermediate

Repeat Customers

Find customers who placed more than one order. Return columns: customer_name, order_count. Order results by: order_count DESC, customer_name.

Subqueries
Intermediate

Orders Above Average Value

Find orders whose total amount is greater than the average order value. Return columns: id, customer_id, total_amount. Order results by: total_amount DESC.

Aggregations
Intermediate

Low Stock Value

Calculate inventory value for products with fewer than 200 units. Return columns: name, stock, price, inventory_value. Order results by: inventory_value DESC.

String Functions
Intermediate
PRO

Employee Names Containing c

Find employee full names containing the letter c, case-insensitively. Return columns: first_name, last_name. Order results by: first_name.

String Functions
Intermediate
PRO

Employee Names Containing d

Find employee full names containing the letter d, case-insensitively. Return columns: first_name, last_name. Order results by: first_name.

String Functions
Intermediate
PRO

Employee Names Containing e

Find employee full names containing the letter e, case-insensitively. Return columns: first_name, last_name. Order results by: first_name.

String Functions
Intermediate
PRO

Employee Names Containing i

Find employee full names containing the letter i, case-insensitively. Return columns: first_name, last_name. Order results by: first_name.

String Functions
Intermediate
PRO

Employee Names Containing l

Find employee full names containing the letter l, case-insensitively. Return columns: first_name, last_name. Order results by: first_name.

String Functions
Intermediate
PRO

Employee Names Containing o

Find employee full names containing the letter o, case-insensitively. Return columns: first_name, last_name. Order results by: first_name.

ORDER BY
Intermediate

Top 1 Salaries

Return the 1 highest-paid employees. Return columns: first_name, last_name, salary. Order results by: salary DESC, id.

ORDER BY
Intermediate

Top 2 Salaries

Return the 2 highest-paid employees. Return columns: first_name, last_name, salary. Order results by: salary DESC, id.

ORDER BY
Intermediate
PRO

Top 3 Salaries

Return the 3 highest-paid employees. Return columns: first_name, last_name, salary. Order results by: salary DESC, id.

ORDER BY
Intermediate
PRO

Top 4 Salaries

Return the 4 highest-paid employees. Return columns: first_name, last_name, salary. Order results by: salary DESC, id.

ORDER BY
Intermediate
PRO

Top 5 Salaries

Return the 5 highest-paid employees. Return columns: first_name, last_name, salary. Order results by: salary DESC, id.

ORDER BY
Intermediate
PRO

Top 6 Salaries

Return the 6 highest-paid employees. Return columns: first_name, last_name, salary. Order results by: salary DESC, id.

ORDER BY
Intermediate
PRO

Top 7 Salaries

Return the 7 highest-paid employees. Return columns: first_name, last_name, salary. Order results by: salary DESC, id.

ORDER BY
Intermediate
PRO

Top 8 Salaries

Return the 8 highest-paid employees. Return columns: first_name, last_name, salary. Order results by: salary DESC, id.

ORDER BY
Intermediate

Salary Ranking Page 1

Return two employees from salary ranking page 1. Return columns: first_name, last_name, salary. Order results by: salary DESC, id.

ORDER BY
Intermediate

Salary Ranking Page 2

Return two employees from salary ranking page 2. Return columns: first_name, last_name, salary. Order results by: salary DESC, id.

ORDER BY
Intermediate
PRO

Salary Ranking Page 3

Return two employees from salary ranking page 3. Return columns: first_name, last_name, salary. Order results by: salary DESC, id.

ORDER BY
Intermediate
PRO

Salary Ranking Page 4

Return two employees from salary ranking page 4. Return columns: first_name, last_name, salary. Order results by: salary DESC, id.

ORDER BY
Intermediate
PRO

Salary Ranking Page 5

Return two employees from salary ranking page 5. Return columns: first_name, last_name, salary. Order results by: salary DESC, id.

ORDER BY
Intermediate
PRO

Salary Ranking Page 6

Return two employees from salary ranking page 6. Return columns: first_name, last_name, salary. Order results by: salary DESC, id.

ORDER BY
Intermediate
PRO

Salary Ranking Page 7

Return two employees from salary ranking page 7. Return columns: first_name, last_name, salary. Order results by: salary DESC, id.

ORDER BY
Intermediate
PRO

Salary Ranking Page 8

Return two employees from salary ranking page 8. Return columns: first_name, last_name, salary. Order results by: salary DESC, id.

Showing the first 60 of 90 challenges in this learning path.

Browse and filter all challenges in the Practice Arena

Level guide

What to expect from intermediate SQL exercises

Intermediate SQL challenges combine tables and business rules with JOINs, grouped reports, subqueries and reusable CTEs.

  • Choose join keys without multiplying rows
  • Define the grain before grouping
  • Break multi-step logic into testable query stages