SQ

SQL

beginner

The language every database speaks.

SQL (Structured Query Language) has been the way to talk to relational databases since the 1970s — and it's not going anywhere. Whether you write Python, JavaScript, or Java, your data almost certainly lives in a SQL database. It's arguably the highest return-on-investment language you can learn.

DatabasesData AnalysisBackend DevelopmentReportingData Engineering
0%
0/8 lessons

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.

Bash
# SQLite comes with Python. Or download the CLI:
# https://www.sqlite.org/download.html (sqlite-tools zip)

# Then open a database (creates the file if missing):
sqlite3 mydata.db

# Or install PostgreSQL for the full experience:
winget install PostgreSQL.PostgreSQL

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.