Databases & SQL with PostgreSQL
Learn SQL with PostgreSQL, from the first SELECT to joins, indexes and migrations, then design Tally's database and connect its Express API to it with safe, parameterised queries.
Modules
6
Lessons
36
Level
Intermediate
Project
Reviewed by a mentor
About This Course
Tally's API stores everything in a JSON file, which won't survive real use. This course teaches relational databases from the ground up with PostgreSQL: querying, schema design, joins, integrity, indexes and migrations. You finish by connecting the Tally API to Postgres with safe, parameterised queries.
You'll Be Able To
- Write SQL to create tables and to insert, query, update and delete data.
- Answer real questions with filtering, sorting, aggregates, grouping and date functions.
- Design a normalised schema with keys and constraints that protect the data.
- Combine tables with joins, subqueries and CTEs, including Tally's budget-versus-actual summary.
- Use transactions, indexes, migrations and backups, and query Postgres safely from Node.js.
What's Inside
- 1
Database concepts and setup
4 lessons
Learn why apps keep their data in a database, how tables and keys work, and where PostgreSQL fits in Tally's stack, then get PostgreSQL running and connect with psql.
- 2
Querying data
8 lessons
Ask questions of your data in SQL: choose, filter and sort rows, work with types and NULL, and total spending by category with aggregates, GROUP BY and HAVING.
- 3
Creating and changing data
6 lessons
Create your own tables with keys and constraints, then add, change and remove rows safely with INSERT, UPDATE and DELETE, and group changes into all-or-nothing transactions.
- 4
Relationships and joins
6 lessons
Link Tally's tables with foreign keys, join them back together with INNER and LEFT JOIN, model many-to-many relationships, and answer multi-step questions with subqueries and CTEs.
- 5
Designing the Tally schema
6 lessons
Design Tally's database: turn requirements into a normalised schema, store money exactly, write it as SQL migration files, and fill it with realistic, repeatable seed data.
- 6
Performance and integration
6 lessons
Make Tally's database fast and safe: add indexes and read query plans, back it up with pg_dump, connect from Node with the pg driver, and stop SQL injection with parameters.