skill~240 mindifficulty

SQL Aggregation & Joins

Real questions span multiple tables and need grouped summaries, so joins and aggregation are where SQL becomes genuinely powerful.

1

Learn it

Aggregate functions (COUNT, SUM, AVG) collapse many rows into one per group defined by GROUP BY, with HAVING filtering those groups. JOINs stitch tables together on a shared key, and the join type (INNER vs LEFT) decides which unmatched rows survive. Together they let you answer layered questions like revenue per customer segment.

By the end you’ll be able to

  • Summarize data with GROUP BY and aggregate functions
  • Combine tables with INNER and LEFT JOIN

Free resources

2

Practice

Write a query that joins two tables and returns totals per group, then add a HAVING clause to keep only groups above a threshold.

3

Build it — your output

A multi-table query producing a grouped summary report answering a specific question.

4

Prove it — check yourself

You’re ready to move on when you can honestly say yes to each:

  • Can you explain the difference between INNER and LEFT JOIN with an example?
  • Can you use GROUP BY with HAVING correctly?
  • Can you decide when to filter with WHERE vs HAVING?

Do it with AI

Use a free AI tool as your tutor and pair-programmer. Copy a prompt below into Claude, ChatGPT, or Gemini (for building, try Cursor or Copilot).

The habit: Try it yourself first — a little struggle is where the learning actually happens. Then ask for a hint before the answer — never copy blindly.

  • Understand itClaude / ChatGPT / Gemini

    I'm a beginner learning "SQL Aggregation & Joins". Explain it in simple terms with a real-world analogy, then ask me ONE question to check my understanding — don't reveal the answer.

  • PracticeClaude / ChatGPT / Gemini

    Give me 3 short practice problems on "SQL Aggregation & Joins" (my goal: summarize data with group by and aggregate functions), from easy to hard. Don't include the solutions yet — I'll try them first, then ask you to check.

  • Get unstuckClaude / ChatGPT / Gemini

    I'm stuck on this exercise about "SQL Aggregation & Joins": [paste your attempt here]. Give me ONE small hint to move forward — do NOT give me the full solution.

  • Build & reviewCursor / Copilot

    Here is my work for a "SQL Aggregation & Joins" task: [paste your code or answer]. Review it: point out what's wrong and WHY, and suggest improvements — but let me make the fixes myself.

  • Prove itClaude / ChatGPT / Gemini

    Quiz me on "SQL Aggregation & Joins". Ask me 5 questions one at a time, wait for my answer each time, then tell me if I'm right and briefly why.

My notes