Cheatsheets
The condensed version of the reference: dense tables and one-line patterns you can scan in seconds. Examples use DuckDB SQL against the Garden Shop dataset, with notes where other databases differ.
Cheatsheets are for moments when you remember the concept but not the exact syntax. Keep them open while writing a query, reviewing a result, or translating a pattern from another SQL dialect.
Each sheet favors copyable patterns over long explanation. If a query is failing or the result looks wrong, jump from the cheatsheet into the related reference page or mistake guide for the reason behind the pattern.
SELECT, WHERE, ORDER BY, and LIMIT at a glance.
INNER, LEFT, RIGHT, FULL, and CROSS, with what each one keeps.
COUNT, SUM, AVG, GROUP BY, and HAVING.
Median, percentiles, spread, mode, and histogram recipes.
The everyday date and text functions, with dialect notes.
Half-open ranges, week and month buckets, and date spines.
OVER, PARTITION BY, ranking, LAG/LEAD, and running totals.
Scalar, IN, and EXISTS subqueries plus the WITH clause.
UNION, UNION ALL, INTERSECT, and EXCEPT side by side.
Searched and simple CASE, plus conditional aggregation.
IS NULL, COALESCE, NULLIF, and null-safe equality.
Find duplicates, keep one row per key, and delete copies.
Want the longer explanations? See the Reference section, or practice the patterns in the hands-on SQL lessons.
If you are not sure which syntax you need, begin with query basics, then move to joins or aggregates once the result needs columns from multiple tables or one row per group.