# How I format SQL before reviewing a query

A beginner-friendly guide to SQL formatting, SELECT clauses, joins, WHERE filters, ordering, and safer query review.

- Date: 2026-09-27
- URL: https://ilham.dev/posts/how-to-format-sql-before-reviewing-a-query/
- Markdown: https://ilham.dev/posts/how-to-format-sql-before-reviewing-a-query/index.md
- Tags: sql, database, formatter, tools
- Reading time: 2 min


SQL is easier to review when clauses and joins are on separate lines instead of one long string.

The [SQL Prettify](/tools/sql-prettify/) tool helps me inspect the input and output without writing a one-off script first.

## The simple idea

SQL is easier to review when clauses and joins are on separate lines instead of one long string.

I use it to answer one focused question at a time, then I review the result before using it anywhere important.

## Step 1: Paste the SQL query

Paste the SQL query.

## Step 2: Format it with readable indentation

Format it with readable indentation.

## Step 3: Review selected columns

Review selected columns.

## Step 4: Check joins and join conditions

Check joins and join conditions.

## Step 5: Check WHERE filters before running updates or deletes

Check WHERE filters before running updates or deletes.

## Step 6: Review ORDER BY and LIMIT

Review ORDER BY and LIMIT.

## Step 7: Formatting does not make a query safe; it only makes it easier to inspect

Formatting does not make a query safe; it only makes it easier to inspect.

## My checklist

Before I trust the result, I check:

- Paste the SQL query.
- Format it with readable indentation.
- Review selected columns.
- Check joins and join conditions.
- Check WHERE filters before running updates or deletes.
- Review ORDER BY and LIMIT.
- Formatting does not make a query safe; it only makes it easier to inspect.

The tool makes the mechanical part faster. The decision still belongs to me: is this result correct, safe, and appropriate for the real task?
