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
- 1Use the live tool above — it runs entirely in your browser and never uploads your data.
- 2Paste the sample from the worked example, or use your own input.
- 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
- Format SQL Query OnlineFormat SQL queries online with uppercase keywords and clean indentation. Paste a one-line query and get readable SQL instantly. Free and private.
- PostgreSQL Formatter OnlineFormat PostgreSQL queries with dialect support for JSONB operators, casts and Postgres functions. Paste SQL, choose PostgreSQL and beautify.
- MySQL Query FormatterFormat MySQL queries online with backtick identifiers and MySQL functions handled correctly. Paste your query, pick MySQL and beautify it.
- SQL Server (T-SQL) FormatterFormat T-SQL for Microsoft SQL Server. Handles TOP, schema-qualified names and bracket identifiers. Paste your query and beautify it online.
- Beautify SQL JOIN QueriesFormat multi-table SQL JOIN queries so every join and ON condition sits on its own line. Paste your query and read the relationships clearly.
- BigQuery SQL FormatterFormat Google BigQuery SQL with backtick project.dataset.table names. Choose the BigQuery dialect and beautify analytics queries online.
- Snowflake SQL FormatterFormat Snowflake SQL with database.schema.table names and Snowflake functions. Pick the Snowflake dialect and beautify queries online.
- Format SQL INSERT StatementsFormat multi-row INSERT INTO statements so each VALUES tuple sits on its own line. Easier to review seed data and migrations.
- SQL CTE FormatterFormat SQL queries that use WITH common table expressions. Each CTE is indented clearly so multi-step queries are easy to follow. Free and private.