UtilitySansar
Developer

SQL Formatter / Beautifier

Turn dense SQL into a readable, consistently indented layout with one clause per line, uppercased keywords, and aligned JOINs and subqueries.

工具摘要

此工具接收结构化输入,在浏览器中返回确定性输出,无需上传到服务器。

工具名称
SQL Formatter / Beautifier
输入意图
提供需要转换、校验或分析的原始内容。
输出意图
获得可直接复制、复用或排错的规范化输出。
示例输入
select id,name,email from users where created_at > now()-interval '7 days' order by id desc
示例输出
SELECT id, name, email FROM users WHERE created_at > now() - INTERVAL '7 days' ORDER BY id DESC
Keywords are uppercased; clauses go on their own line. Multiple statements separated by ; are formatted independently.

工具介绍

Turn dense SQL into a readable, consistently indented layout with one clause per line, uppercased keywords, and aligned JOINs and subqueries.

工具概览

A well-formatted SQL query reads like a paragraph, not a wall of words. This tool tokenizes your statement, places each major clause (SELECT, FROM, WHERE, GROUP BY, ORDER BY, JOIN) on its own line, indents subqueries and CTE bodies, and uppercases standard keywords. It keeps quoted identifiers, string literals, and inline comments untouched. Works with PostgreSQL, MySQL, SQLite, SQL Server, and ANSI SQL.

使用场景

  • Clean up SQL pasted from logs or ORMs before reviewing it in a PR.
  • Standardize team query style without installing a CLI formatter.
  • Make a complex CTE chain readable for documentation or onboarding.

输入/输出示例

输入意图
select id,name,email from users where created_at > now()-interval '7 days' order by id desc
输出意图
SELECT
  id,
  name,
  email
FROM users
WHERE created_at > now() - INTERVAL '7 days'
ORDER BY id DESC

常见问题

Will it modify my data or run the query?+
No. The tool only reformats the text. Nothing is executed against any database.
Does it support PostgreSQL-specific syntax?+
Yes. ::casts, $$ dollar-quoted strings, RETURNING, ON CONFLICT, and JSONB operators are recognized and preserved.
Can it format multiple statements at once?+
Yes. Statements separated by semicolons are formatted independently and joined with a blank line between them.

探索更多工具

在下方的 Developer 分类中发现相关工具。

浏览全部 Developer

相关工具

精选可能对你有用的实用工具