June 27, 2026 · 4 min read
The One SQL Skill Every Marketer Actually Needs
Not window functions, not CTEs. The one query pattern that ends 90% of marketing data arguments is embarrassingly simple.
People ask me what SQL course to take before a BigQuery export project. I used to point them at window functions and CTEs, because that's what feels advanced. I don't anymore. The skill that actually changes how a marketer operates is GROUP BY plus a COUNT(DISTINCT) they trust, and knowing when a join silently duplicated their rows.
The argument this ends
A client's team spent two weeks arguing about whether a campaign drove 4,200 conversions or 11,800. Both numbers came from the same warehouse table. The 11,800 number came from a join against a sessions table that fanned out — one conversion joined to multiple session rows because the join key wasn't unique, and nobody had checked. The person who eventually resolved it wasn't the senior analyst, it was a marketing ops person who'd learned to always run COUNT(DISTINCT conversion_id) before and after any join, specifically to catch fan-out.
Most marketing data disputes aren't about methodology. They're about an undetected join fan-out, and the fix is a five-second sanity check.
The actual skill, stated plainly
-- before trusting any join result, run this
SELECT COUNT(*) AS row_count,
COUNT(DISTINCT conversion_id) AS distinct_count
FROM joined_table;
-- if row_count > distinct_count, the join fanned out
-- and every downstream number is inflatedThat's it. It's not glamorous. It won't get you a certification. But a marketer who runs that check reflexively before presenting a number catches the single most common class of error in campaign reporting, and catches it before it becomes a slide in a QBR that someone has to walk back later.
Everything past that — window functions for cohort analysis, recursive CTEs for attribution paths — is genuinely useful, but it's useful on top of a foundation most marketers skip because it looks too basic to teach.