MySQL · Postgres · BigQuery · Snowflake · SQLite · DuckDB

The same date query, every SQL dialect.

Date arithmetic, DATE_TRUNC, formatting, "days between", generate-series, time zones — each shown side by side across six databases.

15 recipes

Every warehouse spells dates differently.

Each recipe puts the same task next to each other in six dialects, with notes on the gotchas (argument order, boundary counting, DATE vs TIMESTAMP) that quietly produce wrong numbers.

FAQ

Are these SQL recipes free?

Yes. Every recipe is free to read and copy, with no account or paywall.

Which dialects are covered?

MySQL, PostgreSQL, BigQuery, Snowflake, SQLite and DuckDB — the same task shown for each.

Why do DATEDIFF results differ?

Argument order differs (MySQL: end, start) and some dialects count crossed boundaries, not full units. Each recipe notes it.

How do I truncate to the month?

DATE_TRUNC in most engines; MySQL has none (use DATE_FORMAT(d, "%Y-%m-01")); SQLite uses date(d, "start of month").

Open the full interactive site ↗