SQL Formatter
Beautify MySQL & PostgreSQL
Format SQL online for MySQL, PostgreSQL, SQLite, BigQuery, and more. Live beautify with dialect and indent—does not run queries.
This conversion runs only in your browser — nothing is uploaded.
- Input0
- Output0
- OptionsStandard SQL · 2 spaces
Input
Output
What is this tool?
This SQL formatter beautifies queries for Standard SQL, MySQL, PostgreSQL, MariaDB, SQLite, BigQuery, PL/SQL, and T-SQL. It restructures whitespace, line breaks, indentation (1–8 spaces), and uppercases keywords so pasted logs, ORM output, and PR snippets are easier to read.
It is not a database client: it does not execute SQL, check privileges, or prove that a query is valid for your schema. Dialect choice mainly affects how identifiers and vendor-specific tokens are tokenized for layout.
Use it to clean one-line queries from logs, prepare reviewable SQL in pull requests, and make joins or nested filters easier to scan before you run them elsewhere.
Common use cases
- Expand a compact ORM or log query into clause-per-line form for code review
- Reformat MySQL vs PostgreSQL snippets with the matching dialect so backticks or
"quoted"identifiers stay correct - Normalize keyword case before sharing a query in docs or a ticket
How to use
- Select the dialect closest to your database, then indent 1–8 spaces.
- Paste SQL. Output updates live (debounced for large pastes).
- Fix any one-line parse error shown above the editors (usually unbalanced parentheses or truncated input).
- Copy the result. Sample loads a small
SELECT+JOINexample.
Dialect notes
| Dialect | Typical identifier quoting | Notes |
|---|---|---|
| Standard SQL / PostgreSQL / SQLite | "double" | PostgreSQL also keeps :: casts readable. |
| MySQL / MariaDB | `backtick` | Prefer MySQL/MariaDB dialect for backtick identifiers. |
| BigQuery | `project.dataset.table` | Dataset-qualified names format cleanly in BigQuery mode. |
| PL/SQL / T-SQL | Vendor-specific | Procedural blocks format best with the matching dialect. |
Examples
| Input / setting | Output | Notes |
|---|---|---|
select id, name from users where active = 1 order by created_at desc (Standard, 2) | SELECT / FROM / WHERE / ORDER BY on separate lines | Classic beautify + uppercase keywords. |
select * from users where id::int = 1 (PostgreSQL) | Cast kept as id::int with clauses split | Dialect-aware cast token. |
select * from \proj.dataset.table` where true` (BigQuery) | Backtick-qualified table preserved | Vendor quoting edge many generic formatters mishandle. |
SELECT * FROM users WHERE ( | Parse error at EOF / expected ) | Structural failure—not a schema or “wrong column” check. |
Practical pitfalls
- This is not query execution or DB validation. A formatted query can still be wrong for your schema, permissions, or engine version.
- Wrong dialect can mistreat identifier quotes (
"vs`) and vendor functions—pick the engine you will run against. - Minify / one-line compact is out of scope; only pretty-print is available.
- Typos in keywords (
selekt) may pass through without an error—the formatter is not a full SQL linter.
References
이 도구는 무엇인가요?
Standard SQL, MySQL, PostgreSQL, MariaDB, SQLite, BigQuery, PL/SQL, T-SQL 쿼리를 브라우저에서 읽기 쉽게 정렬합니다. 공백·줄바꿈·들여쓰기(1–8칸)·키워드 대문자화를 적용합니다.
DB 클라이언트가 아닙니다. 실행·권한·스키마 검증을 하지 않으며, 방언 선택은 식별자·벤더 토큰을 어떻게 나눌지에 영향을 줍니다.
로그·ORM 한 줄 쿼리, PR 리뷰용 SQL, 조인·필터 스캔에 맞습니다.
자주 쓰는 경우
- ORM·로그에서 온 압축 쿼리를 절 단위로 펼쳐 코드 리뷰
- MySQL 백틱 / PostgreSQL
"식별자"에 맞는 방언으로 재정렬 - 문서·티켓 공유 전에 키워드 대소문자 정리
사용 방법
- DB에 가까운 방언과 들여쓰기 1–8칸을 고릅니다.
- SQL을 붙여넣으면 결과가 바로 갱신됩니다(큰 입력은 debounce).
- 편집기 위 한 줄 파서 오류(괄호 불일치·잘린 입력 등)를 고칩니다.
- 결과를 복사합니다. Sample은
SELECT+JOIN예제입니다.
Dialect notes
| 방언 | 흔한 식별자 따옴표 | 메모 |
|---|---|---|
| Standard / PostgreSQL / SQLite | "큰따옴표" | PostgreSQL :: 캐스트 유지 |
| MySQL / MariaDB | `백틱` | 백틱 식별자는 MySQL/MariaDB 방언 권장 |
| BigQuery | `project.dataset.table` | 데이터셋 한정 이름 |
| PL/SQL / T-SQL | 벤더 특화 | 프로시저 블록은 해당 방언이 유리 |
예시
| 입력 / 설정 | 출력 | 메모 |
|---|---|---|
select id, name from users where active = 1 order by created_at desc (Standard, 2) | 절별 줄바꿈 + 키워드 대문자 | 기본 beautify |
select * from users where id::int = 1 (PostgreSQL) | id::int 유지 | 방언 인식 캐스트 |
select * from \proj.dataset.table` where true` (BigQuery) | 백틱 한정 테이블 유지 | 일반 포맷터가 자주 깨는 엣지 |
SELECT * FROM users WHERE ( | EOF / ) 기대 파서 오류 | 구조 오류—스키마 검증 아님 |
실무에서 흔한 실수
- 실행·DB 검증이 아닙니다. 포맷된 쿼리도 스키마·권한·엔진 버전과 어긋날 수 있습니다.
- 방언 불일치는
"…"/`…`처리와 벤더 함수에 영향을 줍니다. - 한 줄 minify는 범위 밖입니다(pretty-print만).
- 키워드 오타(
selekt)는 오류 없이 통과할 수 있습니다—완전한 린터가 아닙니다.
참고자료
このツールについて
Standard SQL / MySQL / PostgreSQL / MariaDB / SQLite / BigQuery / PL/SQL / T-SQL のクエリをブラウザで読みやすく整形します。空白・改行・インデント(1〜8)・キーワード大文字化を適用します。
データベースクライアントではありません。実行・権限・スキーマ検証はせず、方言選択は識別子やベンダー固有トークンの分割に影響します。
ログや ORM の1行 SQL、PR レビュー、JOIN・フィルタの読みやすさ向上に向きます。
よくある用途
- ORM / ログの圧縮クエリを句ごとに展開してレビュー
- MySQL のバッククォートと PostgreSQL の
"識別子"に合う方言で整形 - ドキュメント共有前にキーワードの表記をそろえる
使い方
- DB に近い方言とインデント 1〜8 を選びます。
- SQL を貼ると結果がすぐ更新されます(大きな入力は debounce)。
- エディタ上の1行パーサエラー(括弧不足など)を直します。
- 結果をコピーします。Sample は
SELECT+JOIN例です。
Dialect notes
| 方言 | 識別子の引用 | メモ |
|---|---|---|
| Standard / PostgreSQL / SQLite | "二重" | PostgreSQL の :: キャストを保持 |
| MySQL / MariaDB | `バッククォート` | バッククォート識別子向け |
| BigQuery | `project.dataset.table` | データセット修飾名 |
| PL/SQL / T-SQL | ベンダー固有 | 手続きブロックは該当方言が有利 |
例
| 入力 / 設定 | 出力 | メモ |
|---|---|---|
select id, name from users where active = 1 order by created_at desc (Standard, 2) | 句ごとに改行 + キーワード大文字 | 基本の整形 |
select * from users where id::int = 1 (PostgreSQL) | id::int を保持 | 方言対応キャスト |
select * from \proj.dataset.table` where true` (BigQuery) | バッククォート修飾を保持 | 汎用フォーマッタが崩れやすい例 |
SELECT * FROM users WHERE ( | EOF / ) 期待のエラー | 構造エラー(スキーマ検証ではない) |
実務での落とし穴
- 実行・DB 検証ではありません。 整形後でもスキーマや権限と合わないことがあります。
- 方言の取り違えは引用符とベンダー関数に影響します。
- 1行 minify は範囲外(pretty-print のみ)。
- キーワード誤字(
selekt)はエラーにならないことがあります。
参考資料
¿Qué es esta herramienta?
Embellece consultas Standard SQL, MySQL, PostgreSQL, MariaDB, SQLite, BigQuery, PL/SQL y T-SQL en el navegador: espacios, saltos, sangría (1–8) y palabras clave en mayúsculas.
No es un cliente de base de datos: no ejecuta SQL ni valida el esquema. El dialecto afecta cómo se tokenizan identificadores y sintaxis del proveedor.
Útil para logs/ORM en una línea, SQL en PRs y JOINs más legibles.
Casos de uso comunes
- Expandir una consulta compacta de ORM o logs para revisión
- Reformatear con el dialecto correcto (
"vs`) - Unificar mayúsculas de palabras clave antes de compartir
Cómo usar
- Elige dialecto e indentación 1–8.
- Pega SQL; la salida se actualiza al instante (debounce en pegados grandes).
- Corrige el error de parseo de una línea si aparece.
- Copia el resultado. Sample carga un
SELECT+JOIN.
Dialect notes
| Dialecto | Comillas de identificador | Notas |
|---|---|---|
| Standard / PostgreSQL / SQLite | "dobles" | Casts :: en PostgreSQL |
| MySQL / MariaDB | `backtick` | Preferible para identificadores con backtick |
| BigQuery | `proyecto.dataset.tabla` | Nombres calificados |
| PL/SQL / T-SQL | Específico del proveedor | Bloques procedurales |
Ejemplos
| Entrada / ajuste | Salida | Notas |
|---|---|---|
select id, name from users where active = 1 order by created_at desc (Standard, 2) | Cláusulas en líneas + keywords en mayúsculas | Beautify clásico |
select * from users where id::int = 1 (PostgreSQL) | Conserva id::int | Cast por dialecto |
select * from \proj.dataset.table` where true` (BigQuery) | Conserva backticks | Caso que muchos formateadores rompen |
SELECT * FROM users WHERE ( | Error de parseo (EOF / )) | Fallo estructural, no de esquema |
Errores prácticos
- No ejecuta ni valida en la BD. El SQL formateado puede seguir siendo incorrecto para tu esquema.
- Dialecto incorrecto altera comillas y funciones del proveedor.
- Minificar a una línea está fuera de alcance.
- Errores tipográficos en keywords pueden no generar error.
Referencias
Qu'est-ce que cet outil ?
Embelleit les requêtes SQL standard, MySQL, PostgreSQL, MariaDB, SQLite, BigQuery, PL/SQL et T-SQL dans le navigateur : espaces, retours, indentation (1–8) et mots-clés en majuscules.
Ce n’est pas un client de base : pas d’exécution ni de validation de schéma. Le dialecte influence le découpage des identifiants et tokens vendeur.
Utile pour logs/ORM sur une ligne, SQL en revue de PR et JOIN plus lisibles.
Cas d'usage courants
- Déplier une requête compacte issue d’un ORM ou d’un log
- Reformater avec le bon dialecte (
"vs`) - Uniformiser la casse des mots-clés avant partage
Comment utiliser
- Choisissez dialecte et indentation 1–8.
- Collez le SQL ; la sortie se met à jour en direct (debounce si volumineux).
- Corrigez l’erreur de parse d’une ligne si elle apparaît.
- Copiez le résultat. Sample charge un
SELECT+JOIN.
Dialect notes
| Dialecte | Guillemets d’identifiant | Notes |
|---|---|---|
| Standard / PostgreSQL / SQLite | "doubles" | Casts :: PostgreSQL |
| MySQL / MariaDB | `backtick` | Préférer pour les backticks |
| BigQuery | `projet.dataset.table` | Noms qualifiés |
| PL/SQL / T-SQL | Spécifique éditeur | Blocs procéduraux |
Exemples
| Entrée / réglage | Sortie | Notes |
|---|---|---|
select id, name from users where active = 1 order by created_at desc (Standard, 2) | Clauses sur lignes + mots-clés majuscules | Beautify classique |
select * from users where id::int = 1 (PostgreSQL) | Conserve id::int | Cast selon dialecte |
select * from \proj.dataset.table` where true` (BigQuery) | Conserve les backticks | Cas souvent mal géré ailleurs |
SELECT * FROM users WHERE ( | Erreur de parse (EOF / )) | Échec structurel, pas de schéma |
Pièges courants
- Pas d’exécution ni de validation DB. Une requête formatée peut rester incorrecte pour votre schéma.
- Mauvais dialecte : guillemets et fonctions vendeur.
- Minification sur une ligne hors périmètre.
- Une faute de frappe sur un mot-clé peut ne pas lever d’erreur.
Références
这个工具是什么?
在浏览器中美化 Standard SQL、MySQL、PostgreSQL、MariaDB、SQLite、BigQuery、PL/SQL、T-SQL 查询:调整空白、换行、缩进(1–8)并将关键字大写。
不是数据库客户端,不会执行 SQL 或校验 schema。方言主要影响标识符与厂商语法的切分方式。
适合整理日志/ORM 单行 SQL、PR 评审,以及更易扫读的 JOIN。
常见用途
- 把压缩的 ORM/日志查询按子句展开以便评审
- 用匹配方言处理 MySQL 反引号与 PostgreSQL
"标识符" - 分享前统一关键字大小写
如何使用
- 选择最接近的方言与 1–8 空格缩进。
- 粘贴 SQL,结果即时更新(大文本有 debounce)。
- 按编辑器上方的一行解析错误修正(多为括号不匹配)。
- 复制结果。Sample 加载
SELECT+JOIN示例。
Dialect notes
| 方言 | 常见标识符引号 | 说明 |
|---|---|---|
| Standard / PostgreSQL / SQLite | "双引号" | PostgreSQL 保留 :: 转换 |
| MySQL / MariaDB | `反引号` | 反引号标识符请选 MySQL/MariaDB |
| BigQuery | `project.dataset.table` | 数据集限定名 |
| PL/SQL / T-SQL | 厂商特有 | 过程块优先匹配方言 |
示例
| 输入 / 设置 | 输出 | 说明 |
|---|---|---|
select id, name from users where active = 1 order by created_at desc(Standard, 2) | 子句分行 + 关键字大写 | 经典美化 |
select * from users where id::int = 1(PostgreSQL) | 保留 id::int | 方言感知转换 |
select * from \proj.dataset.table` where true`(BigQuery) | 保留反引号限定表 | 通用格式化器易错点 |
SELECT * FROM users WHERE ( | 解析错误(EOF / 期望 )) | 结构错误,非 schema 校验 |
实践中的常见误区
- 不会执行或做数据库校验。 格式化后的 SQL 仍可能与 schema/权限不符。
- 方言选错 会影响引号与厂商函数。
- 单行压缩(minify) 不在范围内。
- 关键字拼写错误可能不会报错——不是完整 SQL linter。
参考资料
這個工具是什麼?
在瀏覽器中美化 Standard SQL、MySQL、PostgreSQL、MariaDB、SQLite、BigQuery、PL/SQL、T-SQL 查詢:調整空白、換行、縮排(1–8)並將關鍵字大寫。
不是資料庫用戶端,不會執行 SQL 或驗證 schema。方言主要影響識別字與廠商語法的切分方式。
適合整理日誌/ORM 單行 SQL、PR 審查,以及更易掃讀的 JOIN。
常見用途
- 把壓縮的 ORM/日誌查詢依子句展開以便審查
- 用相符方言處理 MySQL 反引號與 PostgreSQL
"識別字" - 分享前統一關鍵字大小寫
如何使用
- 選擇最接近的方言與 1–8 空格縮排。
- 貼上 SQL,結果即時更新(大文本有 debounce)。
- 依編輯器上方的一行解析錯誤修正(多為括號不匹配)。
- 複製結果。Sample 載入
SELECT+JOIN範例。
Dialect notes
| 方言 | 常見識別字引號 | 說明 |
|---|---|---|
| Standard / PostgreSQL / SQLite | "雙引號" | PostgreSQL 保留 :: 轉換 |
| MySQL / MariaDB | `反引號` | 反引號識別字請選 MySQL/MariaDB |
| BigQuery | `project.dataset.table` | 資料集限定名稱 |
| PL/SQL / T-SQL | 廠商特有 | 程序區塊優先匹配方言 |
範例
| 輸入 / 設定 | 輸出 | 說明 |
|---|---|---|
select id, name from users where active = 1 order by created_at desc(Standard, 2) | 子句分行 + 關鍵字大寫 | 經典美化 |
select * from users where id::int = 1(PostgreSQL) | 保留 id::int | 方言感知轉換 |
select * from \proj.dataset.table` where true`(BigQuery) | 保留反引號限定表 | 通用格式化器易錯點 |
SELECT * FROM users WHERE ( | 解析錯誤(EOF / 期望 )) | 結構錯誤,非 schema 驗證 |
實務上常見陷阱
- 不會執行或做資料庫驗證。 格式化後的 SQL 仍可能與 schema/權限不符。
- 方言選錯 會影響引號與廠商函式。
- 單行壓縮(minify) 不在範圍內。
- 關鍵字拼寫錯誤可能不會報錯——不是完整 SQL linter。
參考資料
Last reviewed: 2026-07-27
Frequently asked questions
- Does formatting change how my query runs?
- It mainly changes whitespace, line breaks, and keyword casing. Semantics can still break if the wrong dialect is selected (quoting, vendor functions). Always review before running in a database.
- Which SQL dialects are supported?
- Standard SQL, MySQL, PostgreSQL, MariaDB, SQLite, BigQuery, PL/SQL, and T-SQL. Pick the closest match so identifier quoting and vendor tokens format correctly.
- Can I minify SQL to one line?
- No. This page only beautifies (pretty-print). Compacting to a single line is out of scope—use your editor or a dedicated minifier if you need that.
- Is my query uploaded?
- No. Formatting runs only in your browser.