>_ IzzyLab

Topic breakdown

Aggregation is GROUP BY plus an aggregate function like SUM: grouping collapses rows by a column's value, and the function computes a single number per group. The key subtlety is where to place the threshold filter: WHERE cuts off source rows before grouping and cannot work with a not-yet-computed aggregate, whereas a condition on the aggregate's result goes in HAVING, which runs after GROUP BY. To output both the name and the total, the tables are first joined with JOIN. The sort direction is set in ORDER BY.

What's checked

  1. customers with total > 200, descending

What it looks like