SQL Practice
Easy SQL Exercises
Start here. These problems cover the everyday building blocks: filtering rows, sorting, removing duplicates, simple joins and basic counts and sums. Read the schema and sample data, try the query yourself, then reveal the hint and solution.
Easy
15 problems
Topic:
1
Employees earning above a threshold
Filter rows with WHERE and sort the result with ORDER BY.
Filtering & Sorting
2
Count employees per department
Group rows and count them with GROUP BY and COUNT.
Aggregation
3
List customers with their orders
Combine two tables with an INNER JOIN.
Joins
4
List the distinct product categories
Remove duplicate values with DISTINCT.
Filtering & Sorting
5
Orders above a given amount
Filter numeric values and sort the result.
Filtering & Sorting
6
Employees hired after a date
Filter on a date column with a comparison.
Strings & Dates
7
Total sales amount
Add up a column with SUM.
Aggregation
8
Average salary by department
Compute an average per group with AVG and GROUP BY.
Aggregation
9
Top 5 most expensive products
Sort descending and take the top rows with TOP.
Filtering & Sorting
10
Customers from a specific city
Filter text with an equality or LIKE.
Filtering & Sorting
11
Products within a price range
Filter a range with BETWEEN.
Filtering & Sorting
12
Number of orders per customer
Join two tables and count per group.
Aggregation
13
Employees with no manager
Filter NULLs with IS NULL.
Filtering & Sorting
14
Search products by name
Match text patterns with LIKE and wildcards.
Strings & Dates
15
Distinct departments sorted by name
Combine DISTINCT with ORDER BY.
Filtering & Sorting
No problems match this topic.