RevealTheme logo

SQL格式化工具

格式化並美化SQL查詢:在關鍵字處換行,對欄位清單進行縮排。

如何使用本工具

  1. 1

    Paste or type your SQL query into the input box.

  2. 2

    The formatted version appears instantly in the read-only panel below — there is no separate Format button.

  3. 3

    Select the output text and copy it manually into your editor or query tool.

什麼是SQL格式化工具?

閱讀壓縮成一行的SQL令人痛苦。本格式化工具會在主要關鍵字(SELECT、FROM、WHERE、JOIN等)處換行,並對欄位清單進行縮排,以便於閱讀。其輸出在功能上與輸入完全相同:格式化不會改變語意。

常見使用場景

  • Untangling a one-line SQL query copied out of an application log or ORM debug output so you can read it.

  • Quickly making a SELECT with a long column list scannable before reviewing it in a pull request.

  • Normalizing keyword casing to uppercase across an ad-hoc query you wrote in lowercase.

  • Pasting a minified query from a config file or migration into a readable shape for documentation.

  • Teaching or explaining a query's clause structure by breaking SELECT, FROM, WHERE, and JOIN onto their own lines.

  • Doing a fast cleanup before a query is too short to justify opening a full IDE formatter.

常見問題

這會重寫我的查詢嗎?
不會:格式化純粹是為了美觀。如果你想要進行正確性檢查,請將輸出結果交給linter處理。

相關工具