Problems / Fix Mixed-Case Join Keys / Editorial
lower(trim(account_name)) = lower(trim(company))
' ACME CORP '
' Globex Inc'
'Vandelay Industries'
'Stark Industries'
GROUP BY account_id, account_name
ROUND(SUM(amount), 2)
account_id
Dirty join keys fail silently: an equality join on unnormalized strings does not error, it just returns fewer rows, and downstream totals come out too small. The standard defense is to normalize keys at the join boundary — lower(trim(...)) is the minimum viable normalization, applied symmetrically to both tables, while still displaying the original account_name from the trusted side.
lower(trim(...))
account_name
Solve Fix Mixed-Case Join Keys yourself →