跳到主要内容
uencoder

格式化 and beautify a SQL query

Take minified 或 poorly-indented SQL 查询和 生成 readable, consistently-formatted SQL 具有 keywords uppercased 和 clauses 开 separate lines.

  1. 1

    SQL 从 logs 或 generated 通过 ORMs 是经常单个长 行. Formatting 具有 keywords 开其 own 行, consistent indentation, 和 alias alignment makes 它 readable 为 debugging 和审查.

  2. 2
    SQL 格式化器 →

    Paste SQL 查询. tool formats SELECT/INSERT/UPDATE/DELETE 具有标准 conventions: keywords uppercase, SELECT/WHERE/GROUP 通过开 separate lines, subqueries indented.

  3. 3
    sql-format → word-count

    Use 链接到 格式化 SQL document 具有多个 statements, handling semicolons 和 comments consistently.

常见问题

formatting 改变查询 semantics?
否 — formatting 仅 changes whitespace, capitalization, 和行 breaks. parsed 查询树 是 identical. 总是验证具有差异比较如果 formatter also 'optimizes' (一些 tools rewrite predicates, 哪个能够改变行为).
什么 SQL dialects 是 supported?
标准 SQL (ANSI) syntax 工作 universally. Dialect-specific syntax (PL/pgSQL, T-SQL, MySQL backticks) 可以格式化 imperfectly. formatter focuses 开常见 SELECT/INSERT/UPDATE/DELETE 结构.

解决此任务的工作流

相关工具