SQL is the language of databases, and nearly every job that touches data uses it. This course runs a real database engine (SQLite, compiled to WebAssembly) inside your browser tab with a small shop loaded into it: customers, products, orders, and employees. You write a query, press Run, see the rows, and the checker compares them with the expected result.
The lessons go from reading rows to shaping results, summarizing with aggregates and GROUP BY, combining tables with joins and subqueries, and changing data with INSERT, UPDATE, DELETE, and CREATE TABLE. The course ends in a project, the order report a shop manager reads, that is not started from nothing: one query in each module is saved as a view, and the report joins your views. The database is rebuilt before every run, so experiment freely. Twenty-six lessons, about eight minutes each; progress stays in this browser.
What you will learn
- SELECT, WHERE, ORDER BY, LIMIT
- DISTINCT, LIKE, IN, BETWEEN, NULL
- COUNT, SUM, AVG, MIN, MAX, GROUP BY, HAVING
- INNER and LEFT joins, self joins, subqueries
- INSERT, UPDATE, DELETE, CREATE TABLE, CASE
- A final report assembled from views you built
The final project
The course ends with Project: the order report: the order report, assembled from views you wrote along the way. 5 of the lessons build a part of it, saved in this browser as you go, so the project is assembled from your own work rather than started from nothing.
top_products(ORDER BY and LIMIT) is the view of the three most expensive products, which the report flags as featured.product_values(Expressions and aliases) is the view of each product with the value of its remaining stock.customer_orders(GROUP BY) is the view of how many orders each customer has placed, and how many items.order_lines(Joining three tables) is the view of every order with its customer and product spelled out.availability(CASE expressions) is the view that labels each product out, low, or ok.