Why PostgreSQL?
PostgreSQL (often just "Postgres") is a free, open source relational database. It stores data in tables, you query it with SQL, and it has been developed in the open for over 35 years. Today it's the default choice for a huge number of companies, from startups to banks.
💡 This track assumes you know basic SQL (
SELECT,WHERE,JOIN,GROUP BY). If not, do the SQL track first. It uses the same shop data you'll see here.
Why developers love it
| Strength | What it means for you |
|---|---|
| Reliable | Full ACID transactions. Your data survives crashes and is never half-written. |
| Standards-compliant SQL | Window functions, CTEs, MERGE, JSON_TABLE… most SQL you learn anywhere works here. |
| Rich data types | JSON, arrays, UUIDs, ranges, enums, geometric types, full-text search vectors. |
| Extensible | Extensions add whole features: PostGIS (maps), pgvector (AI embeddings), TimescaleDB (time series). |
| Free and open | No licence fees, no vendor lock-in. Every cloud offers managed Postgres. |
How it compares
| Database | Best for |
|---|---|
| SQLite | A single file inside one app (phones, desktop apps, tests). No server. |
| MySQL / MariaDB | Web apps; very popular, simpler feature set. |
| PostgreSQL | General-purpose server database where correctness and features matter. |
| MongoDB | Document storage with a flexible schema (see the MongoDB track). |
A real PostgreSQL, right here
The editors in this track run a real PostgreSQL 18 server compiled to WebAssembly (via the open source PGlite project), inside your browser. Nothing is simulated: the errors, query plans and data types are exactly what a production server gives you.
Each editor starts with its own copy of the sample shop database: customers, products and orders. Press ▶ Run:
The first Run downloads the database engine (a few MB), so it takes a moment. After that, queries are instant.
The output works like psql, Postgres's command-line client. SELECT results show as tables. Other statements print their command tag, such as INSERT 0 1 (zero is a historical object ID; one is the number of rows inserted):
Installing PostgreSQL on your computer
You'll want a local server for real projects. Pick one:
Docker (works everywhere):
docker run --name pg -e POSTGRES_PASSWORD=secret -p 5432:5432 \
-v pgdata:/var/lib/postgresql -d postgres:18macOS: install Postgres.app, or use Homebrew: brew install postgresql@18.
Windows: use the installer from postgresql.org (it includes the pgAdmin GUI).
Linux (Debian/Ubuntu): sudo apt install postgresql.
In the cloud: managed services such as Neon, Supabase, AWS RDS, Google Cloud SQL and Azure run Postgres for you, including backups.
Connecting
Every Postgres server listens on port 5432 by default. Connect with psql:
psql -h localhost -U postgres # asks for the password
psql "postgresql://postgres:secret@localhost:5432/postgres" # a connection URL
docker exec -it pg psql -U postgres # psql inside the Docker containerThe connection URL format is what your apps use too:
postgresql://USER:PASSWORD@HOST:PORT/DATABASEGUI tools like pgAdmin, DBeaver, TablePlus and DataGrip connect with the same details.
Practice
- In the editor below, find every customer from Mumbai.
- Count how many products each category has.
- Add yourself as a customer, then select it back.
1.What port does PostgreSQL listen on by default?
2.After INSERT INTO t VALUES (1), (2), (3); psql prints which command tag?
3.When would SQLite be a better fit than PostgreSQL?