01

Introduction to SQL

What a database and a table are, and how SQL lets you ask them questions.

02

Basic SQL Queries

Read data with SELECT and FROM, rename columns with aliases, and compute new values with expressions.

03

Filtering Results

Keep only the rows you need with WHERE, AND, OR and NOT, BETWEEN and IN, LIKE with wildcards, and NULL values.

04

Sorting and Limiting Results

Sort results with ORDER BY and page through them with LIMIT and OFFSET.

05

Dates

Compare and sort dates, and use date functions to extract parts of them and calculate with them.

06

Aggregates and GROUP BY

Summarise data with COUNT, SUM, AVG, MIN and MAX, group it with GROUP BY, remove duplicates with DISTINCT and filter groups with HAVING.

07

Conditional Logic and NULL Functions

Add logic to queries with CASE WHEN, handle missing values with COALESCE and NULLIF, and pivot data with SUM(CASE ...).

08

Inner Join

Understand how tables relate to each other and combine them with INNER JOIN.

09

Outer Joins

Keep unmatched rows with LEFT, RIGHT and FULL JOIN, and use them to find missing data.

10

Multi-Table Queries

Join three tables or more, join a table to itself, and see what CROSS JOIN does to the number of rows.

11

String and Number Functions

Clean and transform values with UPPER, LOWER, LENGTH, TRIM, SUBSTR, INSTR, REPLACE, ROUND, ABS and CAST.

12

Set Operations

Combine the results of several queries with UNION, UNION ALL, INTERSECT and EXCEPT.

13

Data Manipulation (INSERT, UPDATE, DELETE)

Change the data itself: add rows with INSERT INTO, modify them with UPDATE and remove them with DELETE.

14

Tables and Constraints (DDL)

Create tables with the right data types, protect your data with constraints, and change or remove tables with ALTER and DROP.

15

Subqueries

Put a query inside another: scalar subqueries, IN and NOT IN, EXISTS and correlated subqueries, and derived tables.

16

CTEs (WITH)

Make long queries readable with WITH: name intermediate results and chain several CTEs.

17

Window Functions

Calculate across rows without grouping them: OVER and PARTITION BY, ROW_NUMBER, RANK and DENSE_RANK, LAG and LEAD, running totals and the top N per group.

18

Capstone Challenges

Three final challenges to put the whole course into practice.

19

What's Next?

You have finished the course. See where SQL can take you next.

SQL course

19 units · 86 chapters · 920 exercises

This course teaches SQL on real tables that run in your browser. You start by reading data with SELECT, then filter it with WHERE, sort and limit it, work with dates and summarise it with COUNT, SUM, AVG and GROUP BY. Next come CASE expressions, inner and outer joins, queries across several tables, text and number functions, and set operations. You also learn to change data with INSERT, UPDATE and DELETE and to create tables with constraints. The last units cover subqueries, CTEs and window functions, followed by three capstone challenges.