Just added: Embedded C From Zero
PostgreSQL
-- Which reps' totals beat the average total?
-- Step 1: total per rep. Step 2: compare to the average of those totals.
WITH rep_totals AS (
  SELECT rep, SUM(amount) AS total
  FROM sales
  GROUP BY rep
)
SELECT rep, total FROM rep_totals ORDER BY rep;