Setup
The easiest way to start is SQLite — a full SQL database in a single file, no server needed. It ships with Python and most operating systems.
Lessons
1
Tables & SELECT
A relational database is just spreadsheets with rules: tables made of rows and c…
→
2
CREATE, INSERT, UPDATE, DELETE
Reading data is half the story. The other half: creating tables and changing wha…
→
3
ORDER BY, LIMIT & DISTINCT
Rows in a table have no guaranteed order. If you want the top 10 students by gra…
→
4
COUNT, SUM & GROUP BY
So far every query returned rows as-is. Aggregate functions collapse many rows i…
→
5
JOINs — Combining Tables
Real databases split data across many tables: students in one, courses in anothe…
→
6
Primary Keys, Foreign Keys & Indexes
Why was that query slow? Nine times out of ten: a missing index. Keys and indexe…
→
7
Transactions & Safety
Transfer $100 between accounts: subtract from one, add to the other. If the serv…
→
8
SQL Cheatsheet
Queries, joins, aggregates, and DDL on one page.
→