SQL Practice Challenges – Solve Real Interview Questions

Practice SQL queries with 389 hand-crafted challenges that mirror real interview questions. Improve your skills across SELECT, JOINs, GROUP BY, CTEs, and window functions β€” all in a live SQL editor with instant feedback. Every challenge is free.

1
Select All Users
Retrieve all columns from the users table, limited to 20 rows.
SELECTLIMIT
Easy
β†’
2
Active Products
Find all active products, showing name, category, price and rating. Order by rating descending.
SELECTWHEREORDER BY
Easy
β†’
3
Orders by Status
Count how many orders exist for each status.
GROUP BYCOUNT
Easy
β†’
4
Premium Users
List all premium users (is_premium = 1) showing their full name, email and city.
SELECTWHERECONCAT
Easy
β†’
5
Select All Users (No Limit)
Retrieve all columns from the users table without any row limit.
SELECT
Easy
β†’
6
User Names Only
Get first_name and last_name of all users.
SELECT
Easy
β†’
7
Unique Cities
Find distinct cities from users.
DISTINCT
Easy
β†’
8
Total Users
Count total number of users.
COUNT
Easy
β†’
9
Premium Users
Get all users who are premium.
WHERE
Easy
β†’
10
Users from India
Retrieve users located in India.
WHERE
Easy
β†’
11
Highest Salary First
List employees sorted by salary descending.
ORDER BY
Easy
β†’
12
Top 5 Expensive Products
Find 5 most expensive products.
ORDER BYLIMIT
Easy
β†’
13
Cheapest Product
Find minimum product price.
MIN
Easy
β†’
14
Most Expensive Product
Find maximum product price.
MAX
Easy
β†’
15
Average Product Price
Find average price of products.
AVG
Easy
β†’
16
Total Order Amount
Calculate total order value.
SUM
Easy
β†’
17
Orders by Status
Count orders grouped by status.
GROUP BYCOUNT
Easy
β†’
18
Products per Category
Count products in each category.
GROUP BY
Easy
β†’
19
Recent Users
Find users created after 2023-01-01.
WHERE
Easy
β†’
20
Employees in IT
Find employees in IT department.
WHERE
Easy
β†’
21
High Salary Employees
Find employees with salary greater than 50000.
WHERE
Easy
β†’
22
Discounted Orders
Get all orders where discount is greater than 0.
WHERE
Easy
β†’
23
Available Products
Find products with stock greater than 0.
WHERE
Easy
β†’
24
Users Without Phone
Find users who have no phone number.
WHERE
Easy
β†’
25
Top Rated Products
List products sorted by rating descending.
ORDER BY
Easy
β†’
26
Lowest Salary
Find the employee with the lowest salary.
ORDER BYLIMIT
Easy
β†’
27
Top 3 Salaries
Find top 3 highest paid employees.
ORDER BYLIMIT
Easy
β†’
28
Total Products
Count total number of products.
COUNT
Easy
β†’
29
Average Salary
Calculate average salary of employees.
AVG
Easy
β†’
30
Total Discounts
Find total discount given on orders.
SUM
Easy
β†’
31
Highest Review Rating
Find the highest rating given in reviews.
MAX
Easy
β†’
32
Lowest Review Rating
Find the lowest rating given in reviews.
MIN
Easy
β†’
33
Orders by Country
Count orders grouped by shipping_country.
GROUP BY
Easy
β†’
34
Users per City
Count users in each city.
GROUP BY
Easy
β†’
35
Products by Status
Count products grouped by status.
GROUP BY
Easy
β†’
36
Employees per Department
Count employees in each department.
GROUP BY
Easy
β†’
37
Large Orders
Find orders with item_count greater than 5.
WHERE
Easy
β†’
38
Active Users
Retrieve users with status active.
WHERE
Easy
β†’
39
Recent Employees
Find employees hired after 2020.
WHERE
Easy
β†’
40
Most Helpful Reviews
Find top 5 reviews by helpful_votes.
ORDER BYLIMIT
Easy
β†’
41
Gmail Users
Find users whose email contains gmail.
WHERE
Easy
β†’
42
Products in Price Range
Find products priced between 100 and 500.
WHERE
Easy
β†’
43
Names Starting with A
Find employees whose first name starts with A.
WHERE
Easy
β†’
44
Pending Orders
Find all orders with status pending.
WHERE
Easy
β†’
45
Low Stock Products
Find products with stock less than 10.
WHERE
Easy
β†’
46
Premium User Count
Count number of premium users.
COUNT
Easy
β†’
47
Big Orders
Find orders where total is greater than 1000.
WHERE
Easy
β†’
48
Employees in Delhi
Find employees based in Delhi.
WHERE
Easy
β†’
49
Products Price Ascending
Sort products by price ascending.
ORDER BY
Easy
β†’
50
First 10 Users
Retrieve first 10 users.
LIMIT
Easy
β†’
51
Latest Orders
Get 5 most recent orders.
ORDER BYLIMIT
Easy
β†’
52
Total Stock
Find total stock of all products.
SUM
Easy
β†’
53
Average Helpful Votes
Find average helpful votes in reviews.
AVG
Easy
β†’
54
Unique Categories
Get distinct product categories.
DISTINCT
Easy
β†’
55
Total Orders
Count total orders.
COUNT
Easy
β†’
56
Highest Order Value
Find maximum order total.
MAX
Easy
β†’
57
Lowest Order Value
Find minimum order total.
MIN
Easy
β†’
58
Users from USA
Find users located in USA.
WHERE
Easy
β†’
59
Active Employees
Find employees with active status.
WHERE
Easy
β†’
60
Popular Products
Find products with review_count greater than 100.
WHERE
Easy
β†’

Master SQL for Technical Interviews

SQL is the most in-demand data skill for analyst, data engineer, and backend developer roles. Whether you are preparing for a FAANG data interview, a business analyst assessment, or your first SQL screening round, consistent hands-on SQL practice is what separates candidates who pass from those who don't. Every SQL interview question you solve here runs against a real database β€” not a toy example β€” so the skills transfer directly to your next interview.

Our SQL practice challenges are grouped into three difficulty levels so you can build confidence systematically. Start with Easy SQL exercises to solidify the foundations, progress to Medium SQL problems that cover the core of most interviews, then tackle the Hard SQL challenges that involve advanced patterns used at senior levels.

Easy SQL Challenges(104 challenges)

Core syntax: SELECT, WHERE, ORDER BY, GROUP BY, HAVING, COUNT, SUM, AVG. Perfect for beginners or anyone returning to SQL after a break. These are the foundations every SQL interview tests.

Medium SQL Challenges(85 challenges)

Intermediate SQL: INNER, LEFT, RIGHT and FULL OUTER JOINs, subqueries, CASE WHEN expressions, string functions, and date arithmetic. The bread and butter of analyst and data engineer interviews.

Hard SQL Challenges(200 challenges)

Advanced SQL: window functions (ROW_NUMBER, RANK, LAG, LEAD), Common Table Expressions (CTEs), recursive queries, cohort analysis, RFM segmentation, and rolling aggregations.

SQL Interview Questions You Will Practice

All SQL practice problems run against a shared e-commerce database with tables for users, orders, products, and sessions β€” the exact schema type used in real data take-home tests and live SQL interview rounds. Topics covered across all 389 SQL challenges include:

  • SELECT, WHERE, ORDER BY, LIMIT
  • GROUP BY, HAVING, aggregations
  • INNER, LEFT, RIGHT, FULL OUTER JOINs
  • Subqueries and correlated subqueries
  • CASE WHEN expressions
  • String and date functions
  • Window functions: ROW_NUMBER, RANK
  • LAG, LEAD, NTILE, PERCENT_RANK
  • CTEs and recursive queries
  • Running totals and rolling averages
  • Cohort retention analysis
  • RFM customer segmentation

How SQL Practice Challenges Work

Pick any challenge from the list above and write your SQL query in the live editor. Run it against the real database and see your results instantly β€” no setup, no local database, no installation required. Each challenge includes a hint if you get stuck, and a fully worked solution to compare your approach against. The fastest way to improve at SQL is to write real queries against real data every day.

After practising with challenges, test your readiness with our SQL Skill Test β€” a timed 15-question assessment that mirrors a real SQL interview round and generates a shareable certificate when you pass. You can also explore the SQL Playground to run any free-form query on the same database.

Frequently Asked Questions

Are these SQL challenges free?+

Yes β€” all 389 SQL challenges are completely free, including the advanced window function and CTE problems. Create a free account to track your progress.

What SQL dialect is used?+

The SQL challenges use SQLite syntax, which is compatible with standard SQL for everything they cover.

Are these challenges good for SQL interview preparation?+

Yes. Every challenge is modelled on real SQL interview questions asked at tech companies, analytics teams, and data engineering roles. The Medium and Hard tiers specifically target the JOIN, window function, and CTE patterns that appear most in interviews.

How do I get started with SQL practice?+

Click any challenge above to open it in the live SQL editor. No installation needed. If you're new to SQL, start with the Easy challenges and work your way up. Use the hint button if you get stuck.