What you'll learn
Each lesson is short and hands-on, building on the last. You'll go from your very first SELECT to joins, subqueries, and window functions — every example ready to run in SQL Server, MySQL, and PostgreSQL.
What a database is, what SQL does, and how to think about talking to your data.
Tables, columns, rows, and keys — how to read a database diagram and see how tables relate.
Your first SELECT: pull columns, get distinct values, and limit how many rows come back.
Narrow results with WHERE — exact matches, comparisons, LIKE, IN, and combining conditions.
Order results with ORDER BY, ascending or descending, across one or more columns.
Combine related tables with inner and outer joins — and know exactly which rows come back.
Calculate new columns, build readable output, and give columns friendly names with aliases.
Put built-in functions to work: COUNT, MIN, MAX, AVG, SUM, and more.
Rank and number rows and look across them with ROW_NUMBER, RANK, PARTITION BY, and LAG.
Group rows with GROUP BY and filter groups with HAVING to turn detail into totals.
Use one query inside another to answer questions a single query can't.
Add new rows to a table with INSERT, safely and predictably.
Update and delete existing records with confidence — and avoid the classic mistakes.
Create your own tables and other database objects from scratch.
Save a query as a reusable view to simplify the questions you ask most.
The essentials of who can see and do what inside a database.
Alter tables and objects as your needs change, without starting over.
Building your own tables? See the reference on auto-incrementing primary keys — one for each database.
Choose the right type for each column and understand how databases store your data.
A tour of the more powerful tools you'll reach for as you grow.
Handle dates and times — often the trickiest part of real-world data — with confidence.
Learn by doing
Download the practice database and every example query, ready to run in all three databases.