GROUP BY establishes one result row per group. Every selected field must be grouped or aggregated. Before calculating a total, decide what a source row represents and whether a duplicate should count again. A count of orders and a count of customers answer different questions.
WHERE filters source rows before grouping. HAVING filters the grouped result. PostgreSQL's FILTER clause lets you calculate a conditional count without discarding other rows needed by the denominator. The groups with no matches remain visible.
SUM skips unknown amounts, so pair money totals with a missing-value count when completeness matters. Do not infer a total from the small visible fixture. Write the aggregation itself. The hidden data adds a customer and an order, changes amounts and removes one email; a fixed answer can't meet the same contract.
Count rows for order volume, including orders whose amounts are missing.