About
About
Copy-paste SQL — by someone who keeps switching between Postgres, BigQuery and a SQLite file and re-googling the same five patterns each time.
Most real SQL questions aren't about the standard — they're about which function this engine
uses. A running total, the top row per group, removing duplicates, a pivot, an upsert, reading a JSON
column: every database does these, but each spells them differently (STRING_AGG vs
GROUP_CONCAT vs LISTAGG; ON CONFLICT vs
ON DUPLICATE KEY UPDATE vs MERGE). This site puts each task on one page with
the exact syntax for each dialect, side by side.
Every recipe covers MySQL (8+), PostgreSQL, SQLite (3.25+), BigQuery, Snowflake, and
DuckDB, with a short explanation, the version requirements where they matter, and the traps
(argument order, NULL handling, whether QUALIFY is available). The examples use plain
placeholder names you swap for your own.
Topics: window functions (running total, top-N per group, dedup, ranking, LAG/LEAD, percent of total), grouping & aggregation (pivot, unpivot, string aggregation, conditional counts, median), insert / update / upsert (ON CONFLICT, MERGE, update-from-join, delete duplicates), JSON, strings, and recursive CTEs. For date and time across dialects, see our companion site datesql.