Developer tools / SQL
Make your SQL make sense.
Turn crowded queries into clear, consistently formatted SQL. Choose your database dialect, set the indentation, and keep working.
Read the quick guidePrivate by design
Formatting runs in this browser. Your query is not sent to a server.
Free online tool
SQL formatter
Paste a query or start with the example.
A small guide
Readable SQL is easier to review.
Formatting cannot fix a slow query, but it can make the structure and intent easier to see. That helps when debugging, reviewing a change, or learning how a query fits together.
Follow the shape of the query
Put major clauses on their own lines, indent selected columns and join conditions, and keep related filters together. The formatter applies a consistent layout so the query is easier to scan.
Before
select name,email from customers where active=1 order by name;
After
SELECT
name,
email
FROM customers
WHERE active = 1
ORDER BY name;
Why choose a dialect?
Database systems share much of SQL, but they also have different syntax and conventions. Selecting the dialect helps the formatter recognize the language you are writing. It does not validate table names, permissions, or whether a query is safe to run.
Quick SQL dialect reference
These common patterns show a few differences between dialects. For repeatable results when limiting rows, add an ORDER BY clause using columns that uniquely order the rows. TOP goes after SELECT; LIMIT and FETCH go after the other query clauses.
| Dialect | Return up to 5 rows | Join two text values |
|---|---|---|
| Standard SQL | FETCH FIRST 5 ROWS ONLY |
first_name || last_name |
| PostgreSQL | LIMIT 5 |
first_name || last_name |
| MySQL | LIMIT 5 |
CONCAT(first_name, last_name) |
| SQL Server | TOP (5) |
CONCAT(first_name, last_name) |
| Oracle SQL | FETCH FIRST 5 ROWS ONLY |
first_name || last_name |
The row limits are clauses, while the concatenation examples are expressions; use them in their respective positions in a query. The text examples omit a separator and assume non-NULL values; concatenation behavior with NULL differs by database. Oracle row limiting requires Oracle Database 12c or later; SQL Server's CONCAT requires SQL Server 2012 or later. Check your database version and documentation before using version-specific syntax.
A few habits that help
Practice with a complete example in SQL INNER JOIN vs LEFT JOIN, including sample data and expected results.
- Use explicit column names instead of
SELECT *when you know which fields you need. - Keep join conditions close to the join they belong to.
- Review generated SQL before running it, especially when it changes production data.
Does this tool store or upload my SQL?
No. Formatting happens in your browser with JavaScript. The query is not submitted to TeachyLeaf.
Does formatting change what a query returns?
The formatter is intended to change whitespace and keyword presentation, not query meaning. Always review the output and test queries in your own database environment.
Which SQL dialects are available?
This first version supports Standard SQL, PostgreSQL, MySQL, SQL Server, and Oracle PL/SQL. More dialects can be added as the tool grows.