22/30
Part 4 of 5 · Type trapsLearn

Each symptom points at a few bug classes

Run, compare, and name the class of each difference. One check usually tells the classes apart.

SymptomPoints atThe check
A count or sum too highcounting rows, not things; a join that repeats rowsrows before and after each join; COUNT(*) against distinct keys
One side's sums too high, the other side's righta fan-outgroup the joined rows by the one side's key, keep counts above 1
A row or group missingan inner join; a WHERE on a LEFT JOIN's right side; a NULL comparisonkeys on the left against rows in the output
No rows at allNOT IN over a NULL; a condition that's never truerun the subquery alone; count NULLs in the column
1 where 0 belongsCOUNT(*) over a LEFT JOIN's empty rowcount a right-hand key instead
NULL where 0 belongsSUM over no rowswrap the sum in COALESCE
A rate of exactly 0 or 1integer divisionlook at the numerator and denominator alone, then cast an operand
Off at the ends of a rangeBETWEEN on timestamps; an inclusive end; time zonesfixture rows late on the last day and just after it