Format Long SQL SELECT Statements

Format SELECT statements with dozens of columns. Each column lands on its own line so wide queries are easy to read, edit and review.

Part of the free SQL Formatter. Runs in your browser — nothing is uploaded.

Format Long SQL SELECT Statements

Wide SELECT lists with 15 or 20 columns turn into a wall of text. Formatting places one column per line, which makes it easy to add, remove or comment out a field and to see what changed in a diff.

Worked example: A 14-column SELECT with an IN filter

Input

select id, first_name, last_name, email, phone, address_line1, address_line2, city, state, postal_code, country, created_at, updated_at, last_login_at from accounts where is_active = true and country in ('US','CA','GB') and created_at > '2025-01-01';

One column per line

SELECT
  id,
  first_name,
  last_name,
  email,
  phone,
  address_line1,
  address_line2,
  city,
  state,
  postal_code,
  country,
  created_at,
  updated_at,
  last_login_at
FROM
  accounts
WHERE
  is_active = TRUE
  AND country IN ('US', 'CA', 'GB')
  AND created_at > '2025-01-01';

Practical tip

Prefer listing columns over SELECT *. Explicit columns make queries faster to review and stop schema changes from silently altering results.

How to use this SQL Formatter

  1. 1Use the live tool above — it runs entirely in your browser and never uploads your data.
  2. 2Paste the sample from the worked example, or use your own input.
  3. 3Copy the result, then adapt the same steps in your editor, script, or pipeline.

Format Long SQL SELECT Statements FAQs

Is there a limit on query length?

No fixed limit. Very long statements are handled in your browser, though extremely large scripts may take a moment.

Can I put commas first instead of last?

This formatter uses trailing commas. If your style guide wants leading commas, reformat the output with your editor or linter.

More SQL Formatter pages

Open the full SQL Formatter tool →