SQL projects: six practice projects in the SQL course

Every level of the SQL course ends with a project. Instead of a single task you build a report that a sales team, a warehouse or management would actually ask for. Here are all six projects, what they involve and what you should know first.

In short: six projects with two tasks each, on the practice database of an office supplies shop or on a table built for the project. Each project task counts three times as much as a single exercise. The level 1 project is free; the projects from level 2 on are part of Premium.

What makes a project different

In the lessons you practise one building block at a time: first WHERE, then ORDER BY, later GROUP BY or joins. At work, though, nobody asks for a building block. The head of sales wants a list, the warehouse wants a reorder, management wants a monthly report. Which pieces you need, and in which order, is up to you to work out.

That is what the projects train. The task describes what the result should look like; you plan the steps to get there. As everywhere in the course, the result is checked, not the text of your query, and it is also checked against changed data you do not see. A query that only happens to match the visible data will not pass.

The six projects at a glance

1. Customer list

Two lists every business needs: a call list of long-standing customers for the sales team and a reorder list for the warehouse. You combine filters, sorting, LIMIT and a calculation in one query.

Wraps up Level 1: Getting started. Prerequisites: Basics: tables, rows, columns, SELECT: query columns, WHERE: filter rows, AND, OR, NOT, IN and BETWEEN, LIKE: pattern matching, NULL and COALESCE, ORDER BY and LIMIT, DISTINCT: drop duplicates, Calculations and column aliases. Access: free.

2. Sales report

Revenue by month and category for the half-year review, leaving out cancelled orders, and a split of customers into tiers A, B and C. The hard part is putting every condition in the right place: WHERE, HAVING or CASE.

Wraps up Level 2: Summarizing data. Prerequisites: COUNT: count rows, SUM, AVG, MIN, MAX, GROUP BY: summarize groups, HAVING: filter groups, CASE WHEN: conditional logic, String functions, Dates and times, plus everything from the earlier levels. Access: with Premium.

3. Order overview

An overview of the large orders with customer, handler and total, and a list of products nobody has ordered in months. Both reports pull together three or four tables and summarize rows.

Wraps up Level 3: Joining tables. Prerequisites: INNER JOIN: joining tables, LEFT JOIN, Joining multiple tables, Self join, UNION, Subqueries, EXISTS and NOT EXISTS, plus everything from the earlier levels. Access: with Premium.

4. Inventory

You work the way a stock team does: book a goods receipt into a new table and into the stock levels, then tidy up the product range and create a view for stock value. This time you really change data.

Wraps up Level 4: Changing data and building tables. Prerequisites: INSERT: adding rows, UPDATE: changing rows, DELETE: removing rows, CREATE TABLE, ALTER TABLE, Primary and foreign keys, Views, Transactions, plus everything from the earlier levels. Access: with Premium.

5. Customer analysis

A ranking of the strongest customers in each segment and a monthly report with cancellations, the previous month and a running total. You build the queries in steps with WITH and use window functions such as RANK and LAG.

Wraps up Level 5: Advanced queries. Prerequisites: WITH (CTE), Window functions: ROW_NUMBER, RANK, Running totals and shares, LAG and LEAD, Pivot with CASE WHEN, Finding duplicates, plus everything from the earlier levels. Access: with Premium.

6. Monthly report

The monthly numbers for management and a ranking for the head of sales. Each query pulls together several tables, groups, conditions and window functions, just like real reporting work.

Wraps up Level 6: Real work and final test. Prerequisites: Order of execution, SQL for Excel users, MySQL, PostgreSQL, SQL Server, plus everything from the earlier levels. Access: with Premium.

After the level 6 project comes the final test, covering every level. Pass it and you get a LearnThisNext certificate with a verification link.

Try the first project

The level 1 project is free. Here is its first part, the call list. You need WHERE with IN and IS NOT NULL, plus ORDER BY and LIMIT. If you get stuck, the three hints below the task will help.

Task Sales is calling long-standing customers today and has time for five calls. Find customers in the USA and the UK who have a phone number on file, oldest customers first (by customer_since), at most 5. Columns: customer (the name), city, phone and customer_since, in this order and with exactly these names.

customers 12 rows, 7 columns
customer_idnamecitycountrycustomer_sincesegmentphone
1Harbor Fremont PartnersBostonUSA2021-03-15Business617-555-0142
2Emily CarterChicagoUSA2022-07-01ConsumerNULL
3Riverside County OfficeRiversideUSA2020-11-20Government951-555-0110
4Raj PatelLeedsUK2023-01-09Consumer0113 496 0123
5Lakeview Hotel LtdManchesterUK2022-04-18Business0161 496 0456
6Olivia BrooksAustinUSA2024-02-27ConsumerNULL
7Greene & Shaw LLPLondonUK2021-09-05Business020 7946 0321
8Maple Grove High SchoolAustinUSA2023-08-14School512-555-0187
9Chloe EvansBostonUSA2025-05-30Consumer617-555-0199
10Northline Printing CoTorontoCanada2020-06-12Business416-555-0133
11Daniel KimSeattleUSA2024-10-03ConsumerNULL
12Westbrook Dental ClinicChicagoUSA2022-12-01Business312-555-0164

How to tackle a project

  1. Read the task twice. Note which columns are wanted, which rows belong in the result and whether a sort order is required.
  2. Start with FROM. Which table or tables do you need? Run a plain SELECT * first and look at the data.
  3. Build the query in steps. First the condition, then the grouping, then the sorting. Run it after every step and check that the row count makes sense.
  4. Split big tasks. From level 5 on, WITH helps: each intermediate step gets a name and you can check it on its own.
  5. Check the edges. What happens to empty values, cancelled orders, customers without an order? These are the spots where the hidden test data most often catches a query out.

Points and access

Each of the two project tasks in a level counts three times as much as a single exercise, because you solve several steps at once. All of level 1 is free, its project included. From level 2 on, the first exercise in every lesson is free. The projects from level 2 on, however, are fully part of Premium, even when they are the first task on their page.

Frequently asked questions

Do I have to finish every lesson of a level first?

No. You can open any project at any time, from level 2 with Premium. Without the lessons of that level it gets hard, though, because each project combines exactly those building blocks. The prerequisites above list them.

Is there only one right answer?

No. The result is checked. BETWEEN or two comparisons, a subquery or a join: all are fine as long as the right rows and columns come out. Some tasks require a particular keyword because that is what they are about. The task then says so.

Can I redo a project?

Yes. You can solve every task as often as you like. As with all exercises, points are awarded the first time you solve it.

Do I need my own database?

No. All projects run in your browser against our practice database. There is nothing to install.

Ready for your first project?

If the call list above still feels hard, start with level 1 of the SQL course. It is free and ends with exactly this project.

Go to the SQL course See Premium

Write to us

Choose language

Select your preferred language