SQL test: free practice

Seven graded questions on four generated tables — customers, products, employees and orders — running in SQLite inside your browser. Write the query, run it, get graded on the result set (not on whether you typed the exact same SQL as the key).

Your test

You have four tables in SQLite: customers, products, employees, and orders (51 orders). Write SQL for each question and run it. Results are graded against the engine answer (column aliases OK; row order only matters when the question asks for ORDER BY / ranking).

Test #2401 7 questions about 30 min 0:00 SQLite: loading…
customers · 10 rows · header in row 1
AidBnameCregionDcity
21Rosa IbrahimNorthTulsa
32Grace KowalskiEastMesa
43Rosa FosterEastDayton
54Lucia AdeyemiEastOmaha
65Rosa ChenWestDayton
76Priya BennettSouthMesa
87Leila LopezEastFresno
98Yuki ReyesEastProvo
109Rosa ParkSouthDayton
1110Zara ShahEastReno

Tables are loaded into an in-browser SQLite database (sql.js). Write a query per question, press Run (or Check all). Only the result set is graded — aliases and extra whitespace are fine.

  1. 1

    Return the id and amount of every order with amount >= 266. Order by id ascending.

    SELECTWHERE

  2. 2

    For each customer region, return region and total_amount (SUM of order amounts) only for regions whose total_amount is greater than 1414.

    GROUP BYHAVINGJOIN

  3. 3

    For order id 1045, return the customer name as customer_name and the product name as product_name (one row).

    JOIN

  4. 4

    Return id and order_date for every order placed in June 2026. Order by id ascending.

    WHEREDates

  5. 5

    Return id, name, and order_count for every customer whose number of orders is strictly greater than the average order count per customer (include customers with zero? no — only those who appear in orders). Order by id.

    SubqueryCTEGROUP BY

  6. 6

    For each product, return product_name, revenue (SUM of order amounts), and revenue_rank using RANK() ordered by revenue descending (ties share a rank). Order the output by revenue descending, then product id.

    WindowRANKJOIN

  7. 7

    By order_date, return order_date, day_amount (sum of amounts that day), and running_total (cumulative sum of day_amount ordered by date). Order by order_date ascending.

    WindowSUMRunning total

What this test covers

  • SELECT / WHERE — filter orders by amount.
  • GROUP BY / HAVING — region revenue with a threshold.
  • JOINs — customer and product names for one order.
  • Date filters — orders in a given month.
  • Subquery / CTE — customers above average order count.
  • Window functions — RANK by product revenue and a running total by date.

Short skill sets (one topic each) live on the SQL practice page. Analysts who also need spreadsheet work can browse Excel tests by topic or job.

Questions people ask

Is this an official SQL certification or vendor exam?

No. It is practice we write ourselves: generated tables and questions graded by comparing your query’s result set to the engine answer. We do not copy any employer or vendor exam.

What database runs in the browser?

SQLite via sql.js (WebAssembly), loaded only on SQL pages so the rest of the site stays light. Standard SELECT / JOIN / GROUP BY / CTE / window syntax that SQLite supports.

Does column order or alias names matter?

Column count must match. Aliases can differ; values are compared case-insensitively with money-style floats rounded to two decimals. Row order only matters when the question asks for ORDER BY or a ranked list.

How long should this take?

Seven questions, about 30 minutes. Re-run on new data until you can finish cleanly.

Keep practicing

Browse all tests by type, topic or job