PostgreSQL Query Generator
SQL ToolsBuild Postgres SELECT, INSERT, UPDATE, DELETE and DDL from a form.
Runs entirely in your browser โ nothing is uploaded
Features
- SELECT with joins, filters, grouping, ordering and limits.
- INSERT, UPDATE, DELETE and CREATE TABLE from the same form.
- Postgres-native types, RETURNING and ON CONFLICT support.
- Double-quoted identifiers where they are needed.
How to use the PostgreSQL Query Generator
- 1Choose the statement type and target table.
- 2Fill in columns, conditions and clauses.
- 3Copy the generated Postgres SQL.
Frequently asked questions
Why are some identifiers quoted?
Postgres folds unquoted identifiers to lower case, so anything with capitals, spaces or reserved words must be double-quoted to survive.
Does this protect against SQL injection?
It escapes the literal values you enter so the generated statement is well formed, but generated SQL is a starting point, not a safe pattern to copy into an application. In application code, always use parameterised queries and let the driver handle values. String-built SQL is unsafe however carefully the escaping was done.
What is different about Postgres syntax?
Double quotes for identifiers rather than backticks, and quoted identifiers are case-sensitive while unquoted ones fold to lower case. RETURNING can hand back rows from an INSERT, UPDATE or DELETE, which saves a round trip. ON CONFLICT handles upserts. Those are the differences that most often break a query moved from MySQL.
Can I use the output directly in a migration?
Read it first. Generated DDL reflects exactly what you described in the form and knows nothing about your existing indexes, constraints, defaults or the data already in the table. Treat it as a correct starting draft and review it as you would any other migration.