SQL dialect notes

The workbench is a formatter and a mechanical helper, not a compiler for every warehouse. Pick a dialect on the home page to change identifier quote style, template variants, and conversion notes.

The dialect helper can rewrite "ident" to `ident` (and the reverse), turn ::type into CAST(... AS type), and turn ILIKE into LOWER(...) LIKE LOWER(...) when the target dialect does not document ILIKE. Dotted BigQuery backtick paths are left as they are, with a note.

PostgreSQL

PostgreSQL identifiers use double quotes ("ident"). Numbered parameters look like $1. The ::type shorthand and JSONB operators -> and ->> are kept as single tokens. ILIKE, RETURNING, and LATERAL are recognized keywords.

MySQL

MySQL identifiers use backticks (`ident`). Line comments may start with # as well as --. IFNULL and STRAIGHT_JOIN are recognized. The MySQL LIMIT offset, count form is accepted by the tokenizer; convert it by hand if you move the query to another dialect.

SQLite

SQLite identifiers commonly use double quotes. AUTOINCREMENT, GLOB, and JSON_EXTRACT are recognized. This desk does not run the query against a local database file.

BigQuery

BigQuery identifiers often use backticks, including `project.dataset.table` paths, which the dialect helper leaves in backticks when converting away from BigQuery. STRUCT, UNNEST, SAFE_DIVIDE, and QUALIFY are recognized keywords.

Snowflake

Snowflake identifiers use double quotes. VARIANT path syntax with a colon, QUALIFY, FLATTEN, ILIKE, and TRY_CAST are recognized. The ::type shorthand is accepted, the same as in PostgreSQL.

Back to the formatter

Questions

Why does a BigQuery path stay in backticks?

A single backtick identifier such as `project.dataset.table` is a three-part name. Rewriting it as one double-quoted PostgreSQL identifier would be misleading, so the helper keeps the backticks and adds a note.

Does MySQL # always start a comment?

In this tokenizer, # starts a line comment unless it is part of an operator such as #> or #>>. A # character inside a string literal stays in the string.