Curriculum

All 28 Lessons

Each lesson includes a full explanation, code examples, a practice task, common mistakes, and a mini quiz.

01

Introduction to SQL

SQL is the language of relational databases — used in every sector of South African business....

Lesson 1
02

Databases Explained

Tables, rows, columns, relationships, and ACID....

Lesson 2
03

Tables

Tables store data in typed columns and rows....

Lesson 3
04

Primary Keys

A primary key uniquely identifies every row....

Lesson 4
05

Foreign Keys

Foreign keys link tables and enforce referential integrity....

Lesson 5
06

SELECT

SELECT retrieves data — the most important SQL statement....

Lesson 6
07

WHERE

WHERE filters rows returned by a query....

Lesson 7
08

ORDER BY

ORDER BY controls sort order — without it, row order is undefined....

Lesson 8
09

INSERT

INSERT adds new rows to a table....

Lesson 9
10

UPDATE

UPDATE changes existing data. Always use WHERE....

Lesson 10
11

DELETE

DELETE removes rows. Extremely dangerous without WHERE....

Lesson 11
12

CREATE TABLE

CREATE TABLE defines a table's full structure....

Lesson 12
13

ALTER TABLE

ALTER TABLE modifies an existing table's structure....

Lesson 13
14

DROP TABLE

DROP TABLE permanently removes a table and all its data....

Lesson 14
15

Aggregate Functions

COUNT, SUM, AVG, MIN, MAX — summarise sets of rows....

Lesson 15
16

GROUP BY

GROUP BY groups rows to apply aggregates per group....

Lesson 16
17

HAVING

HAVING filters groups after GROUP BY....

Lesson 17
18

JOINS — Overview

Joins combine rows from multiple tables using related columns....

Lesson 18
19

INNER JOIN

INNER JOIN — the most common join, matched rows only....

Lesson 19
20

LEFT JOIN

LEFT JOIN returns all rows from the left table — NULL from right where no match....

Lesson 20
21

RIGHT JOIN

RIGHT JOIN returns all rows from the right table — mirror of LEFT JOIN....

Lesson 21
22

FULL JOIN

FULL OUTER JOIN returns all rows from both tables with NULL where no match....

Lesson 22
23

Subqueries

A subquery is a query nested inside another....

Lesson 23
24

Views

A view is a saved query that acts like a table....

Lesson 24
25

Indexes

Indexes speed up SELECT at the cost of write overhead....

Lesson 25
26

Stored Procedures

Named, reusable SQL blocks — encapsulate business logic....

Lesson 26
27

Database Design

Entities, attributes, relationships — design before you code....

Lesson 27
28

Normalisation

Organise a database to reduce redundancy — 1NF, 2NF, 3NF....

Lesson 28