Lesson overview

Turn table data into useful reports

Each module adds a query skill to the final Student Progress Database Report.

Topic 1

What is SQL?

SQL helps you ask questions of data stored in tables.

Database->Tables->Rows and columns->Query result

Databases, tables, rows and columns

A database stores related tables. A table stores rows of records and columns of fields.

-- Example table idea:
learners(id, learner_name, course, readiness_score)

Real-life example: Student scores, course progress and customer records can all be stored as rows.

Why this matters: It helps you turn table data into the Student Progress Database Report.

How to understand this example: Read it from top to bottom. First notice the key word, then notice the value, element or result it controls.

Key words for this subtopic
Key wordSimple meaningWhy we use itTiny example
Databases, tables, rows and columnsThe main idea in this part of the lessonIt gives you one building block for the final project-- Example table idea: learners(id, learner_name, c...
exampleA small sample that shows the ideaIt helps you see how the concept looks in practice-- Example table idea: learners(id, learner_name, c...
mini-project taskA small build step after the exerciseIt turns the lesson into part of the Student Progress Database ReportStudent Progress Database Report

Quick exercise

Name three columns a learner progress table should have.

Mini-project task

Write the purpose of your Student Progress Database Report.

Spreadsheet thinking vs database thinking

A spreadsheet is often one visible sheet. A database can connect several tables and query only the rows you need.

-- Spreadsheet question:
-- Which learners are below 60?

-- SQL question:
SELECT learner_name, readiness_score
FROM learners
WHERE readiness_score < 60;

Beginner mistake to avoid

Do not use SQL tables as page layout tools. Tables are for structured data.

Why this matters: It helps you turn table data into the Student Progress Database Report.

How to understand this example: Read it from top to bottom. First notice the key word, then notice the value, element or result it controls.

Key words for this subtopic
Key wordSimple meaningWhy we use itTiny example
Spreadsheet thinking vs database thinkingThe main idea in this part of the lessonIt gives you one building block for the final project-- Spreadsheet question: -- Which learners are belo...
exampleA small sample that shows the ideaIt helps you see how the concept looks in practice-- Spreadsheet question: -- Which learners are belo...
mini-project taskA small build step after the exerciseIt turns the lesson into part of the Student Progress Database ReportStudent Progress Database Report

Quick exercise

What is one benefit of filtering data with SQL?

Mini-project task

List the report questions your final project should answer.

Topic checkpoint

You can explain SQL as a way to ask structured questions about table data.

Topic 2

Tables, rows and columns

Good SQL starts with clear table structure.

Table structure

Each row should describe one record. Each column should describe one value about that record.

CREATE TABLE learners (
  learner_id INT,
  learner_name TEXT,
  course TEXT,
  readiness_score INT
);

Why this matters: It helps you turn table data into the Student Progress Database Report.

How to understand this example: Read it from top to bottom. First notice the key word, then notice the value, element or result it controls.

Key words for this subtopic
Key wordSimple meaningWhy we use itTiny example
Table structureThe main idea in this part of the lessonIt gives you one building block for the final projectCREATE TABLE learners ( learner_id INT, learner_nam...
exampleA small sample that shows the ideaIt helps you see how the concept looks in practiceCREATE TABLE learners ( learner_id INT, learner_nam...
mini-project taskA small build step after the exerciseIt turns the lesson into part of the Student Progress Database ReportStudent Progress Database Report

Quick exercise

Which column would store the learner's course name?

Mini-project task

Design a learners table for your report.

Primary key concept

A primary key is a unique identifier for each row. It helps connect tables safely.

-- learner_id can identify each learner uniquely
learner_id | learner_name
1          | Aisha
2          | Daniel

Beginner mistake to avoid

Do not rely on names alone as unique identifiers because two people may share the same name.

Why this matters: It helps you turn table data into the Student Progress Database Report.

How to understand this example: Read it from top to bottom. First notice the key word, then notice the value, element or result it controls.

Key words for this subtopic
Key wordSimple meaningWhy we use itTiny example
Primary key conceptThe main idea in this part of the lessonIt gives you one building block for the final project-- learner_id can identify each learner uniquely le...
exampleA small sample that shows the ideaIt helps you see how the concept looks in practice-- learner_id can identify each learner uniquely le...
mini-project taskA small build step after the exerciseIt turns the lesson into part of the Student Progress Database ReportStudent Progress Database Report

Quick exercise

Why is learner_id safer than learner name?

Mini-project task

Add a unique id column to your learner table design.

Topic checkpoint

You now have the base table structure for the mini project.

Topic 3

SELECT basics

SELECT chooses the columns to show.

SELECT specific columns and SELECT *

Select only the columns you need. SELECT * is useful for quick checking, but reports should usually be specific.

SELECT learner_name, readiness_score
FROM learners;

Why this matters: It helps you turn table data into the Student Progress Database Report.

How to understand this example: Read it from top to bottom. First notice the key word, then notice the value, element or result it controls.

Key words for this subtopic
Key wordSimple meaningWhy we use itTiny example
SELECT specific columns and SELECT *The main idea in this part of the lessonIt gives you one building block for the final projectSELECT *
exampleA small sample that shows the ideaIt helps you see how the concept looks in practiceSELECT *
mini-project taskA small build step after the exerciseIt turns the lesson into part of the Student Progress Database ReportStudent Progress Database Report

Quick exercise

Write a query that shows learner names and courses.

Mini-project task

Write a query to display learner progress.

Aliases with AS

Aliases rename output columns so reports are easier to read.

SELECT
  learner_name AS learner,
  readiness_score AS score
FROM learners;

Why this matters: It helps you turn table data into the Student Progress Database Report.

How to understand this example: Read it from top to bottom. First notice the key word, then notice the value, element or result it controls.

Key words for this subtopic
Key wordSimple meaningWhy we use itTiny example
Aliases with ASThe main idea in this part of the lessonIt gives you one building block for the final projectSELECT learner_name AS learner, readiness_score AS ...
exampleA small sample that shows the ideaIt helps you see how the concept looks in practiceSELECT learner_name AS learner, readiness_score AS ...
mini-project taskA small build step after the exerciseIt turns the lesson into part of the Student Progress Database ReportStudent Progress Database Report

Quick exercise

Create an alias for readiness_score.

Mini-project task

Add readable aliases to your learner progress query.

Topic checkpoint

You can display the fields needed for a clear progress report.

Topic 4

WHERE filtering

WHERE keeps only rows that match a condition.

Equality, comparisons, AND, OR, IN, BETWEEN and LIKE

Filters help find learners below a threshold, in a course, or matching a text pattern.

SELECT learner_name, readiness_score
FROM learners
WHERE readiness_score < 60
  AND course IN ('Python', 'SQL');
SELECT learner_name
FROM learners
WHERE learner_name LIKE 'A%';

Beginner mistake to avoid

Text values usually need quote marks. Numbers usually do not.

Why this matters: It helps you turn table data into the Student Progress Database Report.

How to understand this example: Read it from top to bottom. First notice the key word, then notice the value, element or result it controls.

Key words for this subtopic
Key wordSimple meaningWhy we use itTiny example
Equality, comparisons, AND, OR, IN, BETWEEN and LIKEThe main idea in this part of the lessonIt gives you one building block for the final projectSELECT learner_name, readiness_score FROM learners ...
exampleA small sample that shows the ideaIt helps you see how the concept looks in practiceSELECT learner_name, readiness_score FROM learners ...
mini-project taskA small build step after the exerciseIt turns the lesson into part of the Student Progress Database ReportStudent Progress Database Report

Quick exercise

Write a filter for scores between 50 and 80.

Mini-project task

Find learners below a readiness threshold.

Topic checkpoint

You can identify learners who may need support.

Topic 5

ORDER BY and LIMIT

Sorting and limiting help make reports easier to scan.

Sort ascending or descending

ORDER BY sorts rows. Use DESC for highest first.

SELECT learner_name, readiness_score
FROM learners
ORDER BY readiness_score DESC;

Why this matters: It helps you turn table data into the Student Progress Database Report.

How to understand this example: Read it from top to bottom. First notice the key word, then notice the value, element or result it controls.

Key words for this subtopic
Key wordSimple meaningWhy we use itTiny example
Sort ascending or descendingThe main idea in this part of the lessonIt gives you one building block for the final projectORDER BY
exampleA small sample that shows the ideaIt helps you see how the concept looks in practiceORDER BY
mini-project taskA small build step after the exerciseIt turns the lesson into part of the Student Progress Database ReportStudent Progress Database Report

Quick exercise

How would you show lowest scores first?

Mini-project task

Show top learners by score.

LIMIT / TOP concept

LIMIT previews a few rows. Some SQL systems use TOP instead.

SELECT learner_name, readiness_score
FROM learners
ORDER BY readiness_score DESC
LIMIT 5;

Why this matters: It helps you turn table data into the Student Progress Database Report.

How to understand this example: Read it from top to bottom. First notice the key word, then notice the value, element or result it controls.

Key words for this subtopic
Key wordSimple meaningWhy we use itTiny example
LIMIT / TOP conceptThe main idea in this part of the lessonIt gives you one building block for the final projectLIMIT
exampleA small sample that shows the ideaIt helps you see how the concept looks in practiceLIMIT
mini-project taskA small build step after the exerciseIt turns the lesson into part of the Student Progress Database ReportStudent Progress Database Report

Quick exercise

Write a query that previews the first 10 learners.

Mini-project task

Create a short leaderboard query for the report.

Topic checkpoint

Your report can now rank or preview learner records.

Topic 6

Aggregate functions

Aggregates summarise many rows into useful numbers.

Many rows->Aggregate function->Summary number

COUNT, SUM, AVG, MIN and MAX

Use aggregates to count learners, calculate averages and find highest or lowest scores.

SELECT
  COUNT(*) AS learner_count,
  AVG(readiness_score) AS average_score,
  MIN(readiness_score) AS lowest_score,
  MAX(readiness_score) AS highest_score
FROM learners;

Why this matters: It helps you turn table data into the Student Progress Database Report.

How to understand this example: Read it from top to bottom. First notice the key word, then notice the value, element or result it controls.

Key words for this subtopic
Key wordSimple meaningWhy we use itTiny example
COUNT, SUM, AVG, MIN and MAXThe main idea in this part of the lessonIt gives you one building block for the final projectSELECT COUNT(*) AS learner_count, AVG(readiness_sco...
exampleA small sample that shows the ideaIt helps you see how the concept looks in practiceSELECT COUNT(*) AS learner_count, AVG(readiness_sco...
mini-project taskA small build step after the exerciseIt turns the lesson into part of the Student Progress Database ReportStudent Progress Database Report

Quick exercise

Which function calculates average class score?

Mini-project task

Calculate the average readiness score.

Topic checkpoint

You can summarise learner progress with one report row.

Topic 7

GROUP BY and HAVING

Groups let you summarise categories such as course or topic.

Rows->Groups->Summary table

GROUP BY categories

GROUP BY creates summaries for each category.

SELECT course, AVG(readiness_score) AS average_score
FROM learners
GROUP BY course;

Why this matters: It helps you turn table data into the Student Progress Database Report.

How to understand this example: Read it from top to bottom. First notice the key word, then notice the value, element or result it controls.

Key words for this subtopic
Key wordSimple meaningWhy we use itTiny example
GROUP BY categoriesThe main idea in this part of the lessonIt gives you one building block for the final projectGROUP BY
exampleA small sample that shows the ideaIt helps you see how the concept looks in practiceGROUP BY
mini-project taskA small build step after the exerciseIt turns the lesson into part of the Student Progress Database ReportStudent Progress Database Report

Quick exercise

Which column would you group by for skill area summaries?

Mini-project task

Summarise scores by course or topic.

HAVING vs WHERE

WHERE filters rows before grouping. HAVING filters groups after grouping and aggregation.

SELECT course, AVG(readiness_score) AS average_score
FROM learners
GROUP BY course
HAVING AVG(readiness_score) < 60;

Why this matters: It helps you turn table data into the Student Progress Database Report.

How to understand this example: Read it from top to bottom. First notice the key word, then notice the value, element or result it controls.

Key words for this subtopic
Key wordSimple meaningWhy we use itTiny example
HAVING vs WHEREThe main idea in this part of the lessonIt gives you one building block for the final projectWHERE
exampleA small sample that shows the ideaIt helps you see how the concept looks in practiceWHERE
mini-project taskA small build step after the exerciseIt turns the lesson into part of the Student Progress Database ReportStudent Progress Database Report

Quick exercise

Which clause filters groups after aggregation?

Mini-project task

Identify weak topic groups with an average score below 60.

Topic checkpoint

Your report can now find weak categories, not just weak learners.

Topic 8

JOIN and CASE

Joins combine tables. CASE creates readable labels.

learners table<->quiz_results table->Combined report

INNER JOIN and LEFT JOIN

A JOIN connects two tables by matching a shared value, usually an ID. An INNER JOIN returns matching records. A LEFT JOIN keeps all rows from the left table and matches what it can.

SELECT learners.learner_name, quiz_results.score
FROM learners
INNER JOIN quiz_results
  ON learners.learner_id = quiz_results.learner_id;

Beginner mistake to avoid

Always join on matching key columns, not on display names.

Why this matters: It helps you turn table data into the Student Progress Database Report.

How to understand this example: Read it from top to bottom. First notice the key word, then notice the value, element or result it controls.

Key words for this subtopic
Key wordSimple meaningWhy we use itTiny example
INNER JOIN and LEFT JOINThe main idea in this part of the lessonIt gives you one building block for the final projectINNER JOIN
exampleA small sample that shows the ideaIt helps you see how the concept looks in practiceINNER JOIN
mini-project taskA small build step after the exerciseIt turns the lesson into part of the Student Progress Database ReportStudent Progress Database Report

Quick exercise

What column connects learners to quiz results?

Mini-project task

Join learner names to their quiz scores.

CASE expressions

CASE turns numeric scores into readable labels such as Beginner, Building and Ready.

CASE
  WHEN score >= 80 THEN 'Ready'
  WHEN score >= 50 THEN 'Building'
  ELSE 'Beginner'
END AS readiness_label

Why this matters: It helps you turn table data into the Student Progress Database Report.

How to understand this example: Read it from top to bottom. First notice the key word, then notice the value, element or result it controls.

Key words for this subtopic
Key wordSimple meaningWhy we use itTiny example
CASE expressionsThe main idea in this part of the lessonIt gives you one building block for the final projectCASE
exampleA small sample that shows the ideaIt helps you see how the concept looks in practiceCASE
mini-project taskA small build step after the exerciseIt turns the lesson into part of the Student Progress Database ReportStudent Progress Database Report

Quick exercise

What label should 45 receive?

Mini-project task

Add readiness labels to your report query.

Topic checkpoint

Your report can combine tables and label readiness in plain language.

Topic 9

Clean reporting query

Analysts combine SQL clauses to answer practical questions.

Combine SELECT, JOIN, GROUP BY, CASE and ORDER BY

A reporting query should show clear fields, readable labels and useful ordering.

SELECT
  learners.course,
  COUNT(*) AS attempts,
  AVG(quiz_results.score) AS average_score
FROM learners
JOIN quiz_results
  ON learners.learner_id = quiz_results.learner_id
GROUP BY learners.course
ORDER BY average_score ASC;

Why this matters: It helps you turn table data into the Student Progress Database Report.

How to understand this example: Read it from top to bottom. First notice the key word, then notice the value, element or result it controls.

Key words for this subtopic
Key wordSimple meaningWhy we use itTiny example
Combine SELECT, JOIN, GROUP BY, CASE and ORDER BYThe main idea in this part of the lessonIt gives you one building block for the final projectSELECT learners.course, COUNT(*) AS attempts, AVG(q...
exampleA small sample that shows the ideaIt helps you see how the concept looks in practiceSELECT learners.course, COUNT(*) AS attempts, AVG(q...
mini-project taskA small build step after the exerciseIt turns the lesson into part of the Student Progress Database ReportStudent Progress Database Report

Quick exercise

Which clause controls the final order of report rows?

Mini-project task

Build a final readiness report query outline.

Topic checkpoint

You can now combine SQL skills into a beginner reporting workflow.

Final mini project

Student Progress Database Report

This final project combines tables, SELECT, WHERE, ORDER BY, LIMIT, aggregates, GROUP BY, HAVING, JOIN, CASE and reporting queries.

Sample schemas

learners(learner_id, learner_name, course)
quiz_results(result_id, learner_id, topic, score, attempt_date)

Sample rows

1 | Aisha  | Python
2 | Daniel | SQL

1 | 1 | Loops | 72 | 2026-06-01
2 | 2 | Joins | 48 | 2026-06-02
SELECT
  learners.learner_name,
  learners.course,
  AVG(quiz_results.score) AS average_score,
  CASE
    WHEN AVG(quiz_results.score) >= 80 THEN 'Ready'
    WHEN AVG(quiz_results.score) >= 50 THEN 'Building'
    ELSE 'Beginner'
  END AS readiness_label
FROM learners
LEFT JOIN quiz_results
  ON learners.learner_id = quiz_results.learner_id
GROUP BY learners.learner_name, learners.course
HAVING AVG(quiz_results.score) IS NOT NULL
ORDER BY average_score ASC;

How it works

The query joins learners to results, groups attempts by learner, calculates average score, adds a readable CASE label and sorts weaker areas first.

Upgrade ideas

  • Add more learners
  • Track attempts
  • Add dates
  • Add course categories
  • Create monthly progress reports

Next step

Use SQL in your career roadmap

SQL supports data analyst, data scientist, backend developer, cloud and finance-data routes.