Level 1: Beginner SQL Exercises
Level 1 puts you in front of a small shop database and asks the questions a real team asks: which orders are still waiting to ship? What sold in March? Which customers use our domain? Each exercise shows you the table, and you answer with one query.
Every lesson names one trap that silently gives wrong answers, like
= NULL matching nothing, AND binding tighter than OR, or BETWEEN
losing the last day of the month. Your query runs on real SQLite in your
browser, and each test checks it on different data, so only a correct query
passes.
The 10 exercises in this level
- 1 SQL SELECT and Calculated Columns Pick columns, compute new ones Show each product's price with VAT: pick columns with SELECT, compute a new one, name it with AS and round money with ROUND. Start here — no prerequisites
- 2 SQL WHERE and NULL Filter rows, find missing values List the orders still waiting to ship: filter rows with WHERE and AND, and find missing dates with IS NULL instead of the = NULL trap. Recommended first: SQL SELECT and Calculated Columns
- 3 SQL AND, OR and Parentheses Combine conditions safely Find cheap books and games: combine conditions with AND and OR, and use parentheses so the query means what you say. Recommended first: SQL WHERE and NULL
- 4 SQL Date Ranges and BETWEEN A whole month, to the last minute List the orders placed in March: filter ISO dates as text, and avoid the BETWEEN trap that drops everything after midnight on the last day. Recommended first: SQL WHERE and NULL
- 5 SQL LIKE Patterns Search text with % and _ Find the users of one email domain with LIKE, and anchor the pattern so a look-alike domain doesn't sneak into the results. Recommended first: SQL WHERE and NULL
- 6 SQL ORDER BY, LIMIT and OFFSET Sorting and pagination Build page 2 of a product catalog: sort with ORDER BY, take one page with LIMIT and OFFSET, and break ties so pages never overlap. Recommended first: SQL SELECT and Calculated Columns
- 7 SQL DISTINCT Each value once List the countries your customers come from, each one once, and learn why DISTINCT applies to the whole row, not to the first column. Recommended first: SQL SELECT and Calculated Columns
- 8 SQL COUNT, SUM and AVG One row that sums up a table Summarize the orders in one row: count them, count those with a coupon and average their totals, knowing exactly which rows NULL leaves out. Recommended first: SQL AND, OR and Parentheses
- 9 SQL CASE WHEN If / else for every row Label each order small, medium or large with CASE WHEN, and order the conditions so the first match is the right one. Recommended first: SQL AND, OR and Parentheses
- 10 Project: SQL Order Status Report Everything from this level Build March's order report in one query: count the orders, count the shipped ones and total their revenue with conditional aggregation. Recommended first: SQL COUNT, SUM and AVG, SQL CASE WHEN, SQL LIKE Patterns, SQL Date Ranges and BETWEEN
Frequently asked questions
- Do I need to install a database?
- No. A real SQLite database runs in your browser, built fresh for every test. Nothing to install, no server, no account.
- Is this the same SQL as MySQL or PostgreSQL?
- The queries in this level are standard SQL and work the same in SQLite, PostgreSQL, MySQL and SQL Server. When a function differs between databases, the lesson says so.
- Why does `= NULL` return no rows?
- NULL means "unknown", and comparing anything to unknown is unknown, never true. Use `IS NULL` or `IS NOT NULL`; the "SQL WHERE and NULL" exercise shows the difference.
- Why use ORDER BY with LIMIT?
- Without `ORDER BY`, a database may return rows in any order, so "the first 3" can change from one run to the next. Always sort before you limit, with a second column to break ties.