YOUR AD GOES HERE

Join and Aggregate Data | JOIN, GROUP BY, HAVING & NULLs

Published 01, Oct 2026

The Data Signal


Description:
This is Part 2 of the SQL series. Here, we move beyond querying one table and learn how to combine data without creating incorrect counts, duplicated totals or missing records.

The central question is simple: what does one row represent before and after a join?

You’ll learn how to:
- Understand the grain of a table
- Work with primary and foreign keys
- Recognise one-to-many relationships
- Join tables using matching keys
- Understand how joins change the meaning and number of rows
- Avoid double counting after a join
- Use COUNT, COUNT DISTINCT and SUM
- Aggregate data with GROUP BY
- Understand the difference between WHERE and HAVING
- Keep unmatched records with LEFT JOIN
- Understand the important difference between filtering in ON and WHERE
- Display zero instead of NULL with COALESCE

Practice files and SQL exercises: https://github.com/david-ikenna-ezekiel/thedatasignal/tree/main/sql-masterclass

Chapters
00:00 Why joins can change your answer
00:24 Grain, keys and table relationships
02:31 Counting the inputs before joining
03:35 Preserving grain and calculating revenue
05:45 Avoiding double counting with aggregation
08:20 LEFT JOIN, ON versus WHERE and validation

If this lesson helped you understand joins more clearly, subscribe to The Data Signal for more practical SQL and data tutorials.

Releted More Videos

You May Also Like

YOUR AD GOES HERE

YOUR AD GOES HERE