CleanThisText guide

Format SQL for easier review

Choose the right dialect and separate readable SQL from database validation and execution safety.

Select the database's dialect

Choose Standard SQL, PostgreSQL, MySQL, or SQLite to match the source query. Quoting, operators, and vendor extensions differ. Paste a complete statement and select Run tool.

Formatting runs in the browser without a database connection. An unsupported construct can fail in the formatter even when the database accepts it. Preserve the original instead of removing syntax just to satisfy a formatting parser.

Inspect each clause

Read selected columns, source tables, join conditions, filters, grouping, and ordering separately. A clear layout helps expose a broad filter or missing join condition, but the formatter does not identify these logic errors.

For UPDATE or DELETE, independently verify the intended scope before execution. For SELECT, consider duplicated rows from joins and filters involving nulls. Readability does not establish a correct result set.

Validate in the real environment

Compare original and formatted text if anything looks unexpected, especially comments and dialect-specific quoting. Formatting success says nothing about whether tables, columns, permissions, or indexes exist.

Use database explain facilities, test data, and your normal review process. Parameterize application inputs in application code; this formatter does not escape values or prevent SQL injection.

Worked example

Input

select id from users where active = 1

Result

select
  id
from
  users
where
  active = 1

Clauses become easier to scan. No database checked whether users or active exist.

SQL dialect:
sql

Open SQL Formatter

For the next step

Simple hardware for an offline draft workflow.

Optional picks for moving paper notes into a file and writing through a revision.

MUNBYN portable scanner product photo

MUNBYN portable scanner

A handheld scanner option for bringing paper notes and pages into a digital workflow.

View on Amazon
GLENCREAG RK104 retro mechanical keyboard product photo

GLENCREAG RK104 retro mechanical keyboard

A full-size mechanical keyboard option for long cleanup, formatting, and writing sessions.

View on Amazon

As an Amazon Associate I earn from qualifying purchases.

All referenced CleanThisText tools process pasted text locally in browser memory. Read the privacy explanation.

Use the related tools