SQL for Beginners: Ask Your Data Straight Questions
Read, change and combine data in PostgreSQL without guessing what a query does. This is for people who have never written SQL, or who copy queries without knowing why they work. You will set up PostgreSQL 18, ask a small shop database for rows, change data safely, summarise it, and join tables without losing or doubling rows. If you skip the NULL and join checks, your queries will return answers that look right and are not.
Course access
-
Before You Write a Query (empty)3Lessons · 20 min
-
What a Relational Database Is and Why SQL Exists
What a table, a row, a column and a key are, why data is split across tables and why SQL describes the result instead of the steps. After this, you can say what a query asks for before you run it.
5 min -
Set Up PostgreSQL and Run Your First Query
Start PostgreSQL 18.6 in a Docker container, open psql, run a first query and load the shop database used in every lesson. After this, you have a safe database to practise on and can reset it in a minute.
10 min -
-
-
Asking for Rows (empty)3Lessons · 20 min
-
SELECT, WHERE, ORDER BY and LIMIT
Pick columns, filter rows, sort the result and cut it short, and learn the order the database reads a query in. After this, you can answer most simple questions about a table and read the common errors.
10 min -
NULL Is Not a Value
See what NULL means, why a comparison with NULL returns nothing and how IS NULL, IS DISTINCT FROM and COALESCE deal with it. After this, your conditions stop dropping rows that have missing values.
5 min -
-
-
Building and Changing Data (empty)3Lessons · 20 min
-
CREATE TABLE: Types and Constraints That Matter
Create a table with the right column types and the five constraints you will use all the time, then break each rule on purpose. After this, you can design a small table the database will protect for you.
10 min -
INSERT, UPDATE and DELETE Without Regret
Add, change and remove rows, check the row count and use a transaction as an undo button. After this, a missing WHERE is a mistake you catch before it is saved.
5 min -
-
-
Summaries (empty)3Lessons · 15 min
-
COUNT, SUM and AVG
Count rows, add and average values, and see how aggregates treat NULL and integer division. After this, you can compute a summary number and say exactly what it counts.
5 min -
GROUP BY and HAVING
Get one result row per group and filter groups with HAVING, and learn when a condition belongs in WHERE instead. After this, a how-many-for-each question is one query.
5 min -
-
-
Combining Tables (empty)4Lessons · 20 min
-
Primary Keys, Foreign Keys and Why Tables Are Split
See what goes wrong with one wide table, then use primary keys, foreign keys and a bridge table to store each fact once. After this, you can read the shop's four tables and say how they connect.
5 min -
INNER JOIN and LEFT JOIN
Combine two tables with ON, keep or drop unmatched rows and find rows that have no match. After this, you can show an order next to its customer and list customers with no orders.
5 min -
When a Join Gives Too Many Rows or Too Few
Spot a join that drops rows, repeats them or multiplies them, and check the row count after every join. After this, you can tell a correct join from one that only looks right.
5 min -
-
-
Final Check: SQL for Beginners (empty)1Lessons · 15 min
-
About
Read, change and combine data in PostgreSQL without guessing what a query does. This is for people who have never written SQL, or who copy queries without knowing why they work. You will set up PostgreSQL 18, ask a small shop database for rows, change data safely, summarise it, and join tables without losing or doubling rows. If you skip the NULL and join checks, your queries will return answers that look right and are not.
- Responsible
- Jay P
- Last Update
- 10/02/2026
- Completion Time
- 1 h 50 min
- Members
- 1
Reviews
Sign in to write a reviewComments
Sign in to commentNo comments yet.