Skip to content

Lesson 17 · Python

Databases: Joins, Aggregates & Subqueries

Stitch split tables back together: INNER and LEFT JOIN row by row, GROUP BY with COUNT, AVG and SUM, HAVING versus WHERE, and subqueries that answer questions inside questions.

45 minintermediateData & Persistence

Prerequisites: Databases: SQL Fundamentals

Learning objectives
By the end of this lesson, you will be able to:
  • Explain why data is split across tables and how id columns connect them
  • Join tables with INNER JOIN and LEFT JOIN, predicting which rows survive each
  • Summarize groups with COUNT, AVG, SUM, MIN and MAX behind GROUP BY
  • Filter rows with WHERE and groups with HAVING, choosing correctly between them
  • Use subqueries in WHERE and FROM, and build a query from an English question step by step