Choose your character

It shows in the top bar and on your profile. Change it any time.

Courses / Data and analytics tools

SQL

Write real queries against a real database in your browser, from your first SELECT to expert analyst work.

Start lesson 1Practice interviewTake the assessmentPractice the first unit of every course. No account needed.
97lessons
507checked exercises
16projects, cases and exams
Prepares you for SQL interviews and tests

Projects, case studies and mock exams

Case study · BeginnerThe April numbers

The operations manager needs April in five numbers and a pick for the May newsletter.

6 steps · 25 min
Project · IntermediateMonthly sales report

Build the monthly report finance asked for, one column at a time, ending with a query they can re-run every month.

8 steps · 50 min
Case study · IntermediateThe spring coupon's impact

Marketing wants to know whether to run the SPRING20 coupon again. Compare coupon orders with the rest and make the call.

6 steps · 35 min
Project · AdvancedFrom spreadsheet export to database

Turn the flat export from the old order system into customers, products, orders and order lines, with keys, and prove nothing was lost.

8 steps · 60 min
Project · AdvancedClean the sign-up list

Turn a messy newsletter export into a clean, deduplicated list marketing can send to, and report where sign-ups come from.

7 steps · 45 min
Case study · AdvancedMembership churn

Measure churn in Kestrel Plus by plan, tenure and buying behavior, and name the group to target first.

6 steps · 40 min
Case study · AdvancedSupport response times

Measure how fast support answers against its targets, find what is still waiting, and name the weakest channel.

6 steps · 40 min
Project · ExpertKPI pack for the leadership meeting

Build the first-half KPI pack the leadership team asked for, one number at a time, in a single query.

9 steps · 60 min
Project · ExpertBuild a price history table

Build the price history the finance team needs, apply July price changes the right way, and answer as-of questions from it.

7 steps · 45 min
Case study · ExpertCampaign attribution

Credit orders to the campaigns that led to them, compare first-touch and last-touch views, and find the cheapest campaign per order.

6 steps · 45 min
Case study · ExpertWhat stockouts cost

Measure how often and how long products ran out, estimate the sales lost, and name the product to fix first.

6 steps · 45 min
Mock exam · ExpertSQL certification practice

Twelve questions in the style of a cloud data warehouse SQL certification: six to answer by reasoning, six to write. Allow 30 minutes.

12 questions · 30 min

Practice SQL the way you'll use it at work and in tests: in a query editor with a table browser and a results grid, against the tables of Kestrel, a made-up online store. Every query runs for real in DuckDB, which follows PostgreSQL's rules, so what you learn carries over to PostgreSQL, MySQL, SQL Server and the SQL tests used in hiring.

The course runs from Beginner to Expert. Each lesson teaches one thing in a few short exercises, and every unit ends with a practice set on fresh data. Projects and case studies give you a real brief and several steps to work through, and interview sets and a mock exam get you ready for tests. Your answer is checked by the rows it returns, so any correct query passes, and a wrong one gets a hint about what to fix. Visit plans and credits for current access.

Interview practice

Explain what you've learned in a full-screen interview. Speak or type, then review your answers against the rubric for your level.

Interview loops by job

Beginner

FreeNo account or card needed. Every lesson in this unit is yours to practice.

Query a table

Pick columns, filter rows, sort them and remove duplicates.

7 lessons

Summarize data

Count, total and average, overall and for each group.

4 lessons

Combine tables

Join tables on their keys and handle the rows that do not match.

5 lessons

Create and change data

Create tables, then add, change and remove rows.

5 lessons

Beginner checkpoints

A first case study and the questions a basic SQL screen asks.

2 lessons

Intermediate

Functions and types

If-then logic, types and conversion, and functions for text, dates and numbers.

6 lessons

Nested queries

Queries inside queries, EXISTS, and named steps with WITH.

5 lessons

More joins

Self joins, outer joins from both sides, every combination, and joins on ranges.

5 lessons

Combine results

Stack and compare query results with UNION, INTERSECT and EXCEPT.

3 lessons

Window functions

Rank, number, total and compare rows without collapsing them.

5 lessons

Intermediate projects

A report built step by step, a marketing question, and a medium interview set.

3 lessons

Advanced

Database design

Keys and constraints, changing tables, views, indexes and normalization.

6 lessons

Changing data safely

Transactions, upserts, changes driven by other tables, and code that runs inside the database.

5 lessons

Advanced analytics

Moving windows, percentiles, pivots, recursion, date series and subtotals.

7 lessons

Analyst patterns

The recurring shapes of analyst work: dedup, streaks, sessions, funnels, cohorts and growth.

7 lessons

Advanced projects

Build a database from an export, clean a messy list, and answer two business questions.

5 lessons

Expert

Performance

Read query plans and write queries the database can run fast.

4 lessons

Dialects

What changes between PostgreSQL, MySQL, SQL Server, BigQuery and Snowflake.

3 lessons

Modeling for analytics

Star schemas, history tables and the checks that keep data trustworthy.

4 lessons

Expert projects and exams

End-to-end projects, two case studies, an expert interview set and a mock exam.

6 lessons

Your Work Gym account

Save your progress and pick up on another device. Your browser's progress comes with you.

We'll email you a link. It works once and expires in 15 minutes.

You can keep practicing without an account.