Tsallaka zuwa abun ciki
Justice Tech School

SQL Introduction

SQL (Structured Query Language) is the standard language for reading and changing data in a relational database. Data lives in tables made of rows (records) and columns (fields).

Every lesson uses the same small school database: a students table, a courses table and an enrolments table that links them. The results shown under each query were produced by running it on this data.

The students table

Example
id | name    | country      | score | joined     | referred_by
1  | Ada     | Nigeria      | 92    | 2026-01-10 | NULL
2  | Kofi    | Ghana        | 78    | 2026-01-22 | 1
3  | Amina   | Nigeria      | 85    | 2026-02-03 | 1
4  | Wanjiru | Kenya        | 64    | 2026-02-14 | 2
5  | Tunde   | Nigeria      | 71    | 2026-03-01 | 3
6  | Zainab  | Nigeria      | 88    | 2026-03-09 | 1
7  | Sipho   | South Africa | 59    | 2026-03-20 | 4
8  | Esi     | Ghana        | NULL  | 2026-04-02 | 2

The courses table

Example
id | title         | price | level
1  | Intro to HTML | 0     | Beginner
2  | CSS Basics    | 5000  | Beginner
3  | JavaScript    | 15000 | Intermediate
4  | Python        | 12000 | Beginner
5  | SQL           | 8000  | Beginner

The enrolments table

Example
student_id | course_id | enrolled_on
1          | 1         | 2026-01-11
1          | 3         | 2026-01-15
2          | 4         | 2026-01-25
3          | 4         | 2026-02-05
3          | 5         | 2026-02-20
5          | 1         | 2026-03-02
6          | 2         | 2026-03-10
6          | 4         | 2026-03-12
  • Live SQL in the browser is coming soon. For now, follow along in any SQL tool and compare with the results shown.
  • NULL means "no value known". It is not the same as zero or an empty text.

Quiz Test

What is a row in a table?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.