piapia123
en

SQL Identifier Quotes

Text

Everything runs locally in your browser — nothing is uploaded

Input
Drop a file here to load its contents
Output

Two jobs, each matching a real situation. Adding quotes: moving MySQL-style SQL to Postgres or Oracle. MySQL identifiers are case-insensitive by default, while Postgres folds unquoted identifiers to lower case — a column called `userID` arrives as `userid` and the statement fails with “column does not exist”. Double quotes are what preserve the original casing. Removing quotes: turning Postgres’ exported `"users"` and `"userID"` back into bare identifiers, which read better and paste cleanly into older tools that choke on quotes. ⚠️ The rule that matters most: nothing inside string literals or comments is touched. A naive implementation that quotes every word turns `INSERT INTO t VALUES ('active')` into `'"active"'` — two extra quotes stored in the data, with the statement still executing perfectly, so the mistake surfaces only when someone reads the data back. A small scanner is used instead, and strings, comments and already-quoted identifiers are skipped whole. When a quote cannot be removed, it stays. `"user id"` (a space), `"order"` (a reserved word) and `"2fa"` (leading digit) are all invalid bare identifiers. The quotes are kept and the count is reported, rather than emitting SQL that cannot run.

Features

  • Add double quotes to table names, column names and aliases in bulk
  • Or strip existing double quotes and backticks (backticks become double quotes, which all three engines accept)
  • ⚠️ Nothing inside string literals is touched, including strings using the `''` escape
  • Nothing inside `--` line comments or `/* */` block comments is touched
  • SQL keywords are never quoted (quoting `select` would turn it into a column name)
  • Non-ASCII identifiers are quoted too, so Chinese and accented table names survive
  • When removing quotes, names that cannot be written bare keep theirs, and the count is reported
  • Each row is copyable, and the explanation never ends up in the copied text

How to use

  1. Paste a SQL statement
  2. Choose Add double quotes or Remove double quotes
  3. The result updates as you type; copy it out

FAQ

Will the contents of string literals be changed?
No, and that is the most important rule here. The word `active` in `INSERT INTO t VALUES ('active')` is data, not an identifier; quoting it produces `'"active"'`, and those two extra quotes really are stored in the database. Worse, the statement still executes, so the problem only shows up when the data is read back. Comments are skipped whole for the same reason.
Why are keywords left unquoted?
Because quoting `select` turns it from a keyword into a column name called select, and the statement immediately means something else. A built-in keyword table covers the common ones; a rare keyword that is missing from it could make the statement fail with “column does not exist”, which shows up the moment you run it — it will not silently change the meaning.
Why do some quotes survive removal?
Because the name would be invalid without them. Three cases: a space or special character (`"user id"` would split into two words), a reserved word (`"order"` would collide with `ORDER BY`), and a leading digit (`"2fa"` is not a valid identifier). The quotes stay and the tool tells you how many such names there were — emitting SQL that cannot run would be far worse than leaving a few quotes in place.

Related tools