SQL query guide and searchable reference

A searchable catalogue of the SQL you actually write: the syntax reference (joins, GROUP BY, window functions, CTEs, DDL, transactions), the recipes that keep coming back (find duplicates, top N per group, running totals, keyset pagination, gaps and islands) and the pitfalls that return a plausible wrong answer rather than an error. Every entry carries a syntax skeleton, a runnable example against one small schema, the gotchas, and dialect notes for PostgreSQL, MySQL, SQL Server and Oracle wherever the syntax differs.

About sql query guide and searchable reference

How it works

  1. 1. Type what you are trying to do — duplicate, latest per user, upsert, pagination — or browse a category.
  2. 2. Search covers titles, summaries, tags, examples and notes, so a keyword from the query text finds the entry too.
  3. 3. Open an entry for its syntax, a runnable example, what it does, the traps, and the dialect differences.
  4. 4. Copy the example with one click, or copy the link — every entry is its own URL you can paste into a review.

Common use cases

  • • Remembering the exact syntax for an upsert or a window frame mid-task
  • • Finding the standard query for duplicates, top N per group or a running total
  • • Checking why a LEFT JOIN quietly dropped rows, or why NOT IN returned nothing
  • • Looking up how a query differs between PostgreSQL, MySQL, SQL Server and Oracle

FAQ

Which SQL dialect do the examples use?

They are written in standard SQL, leaning on PostgreSQL syntax where the standard is ambiguous. Entries whose syntax genuinely differs carry dialect notes for PostgreSQL, MySQL, SQL Server, Oracle and SQLite.

Can I link to a single entry?

Yes. Selecting an entry puts its id in the URL, so the link you paste into a pull request or a chat opens on the same entry, with the same search and category filter.

Do the examples run as written?

They target one small sample schema — users, orders, order_items and products, shown on the page — so they read as one coherent database. Swap in your own table and column names.

How is this different from the SQL Formatter?

The formatter pretty-prints a query you already have. This page is the reference for writing one. They sit next to each other in the menu.