SQL · CHEAT SHEET

SQL JOIN Cheat Sheet

INNER, LEFT, anti-join and missing-match patterns with relationship warnings.

FilterWHERE Status = 'Open'
PatternWHERE Code LIKE 'AK%'
GroupGROUP BY Material
Post-filterHAVING COUNT(*) > 1
Missing matchLEFT JOIN ... WHERE right.Key IS NULL
Latest rowROW_NUMBER() OVER(PARTITION BY Key ORDER BY Time DESC)

Use the pattern, then verify the result

Cheat sheets are reminders, not substitutes for checking keys, data types, duplicates and edge cases. Follow the linked learning material when a pattern is new to you.