Developer Tools
SQL Formatter
Format SQL text for better readability.
Before
After
Tips
- SQL keywords such as SELECT, FROM, WHERE, and JOIN are automatically line-broken and aligned, and nested subqueries are properly indented.
- Enabling "Capitalize keywords" auto-uppercases all keywords, improving readability.
- Adjust the indent size to match your team's coding style guidelines.
- Pasting the formatted SQL into code reviews or documentation makes it much easier to read.
- Supports major SQL dialects including MySQL, PostgreSQL, and Oracle.
Side Note — 50 Years of SQL: A History of Relational Databases
SQL originated when IBM developed "SEQUEL" based on the relational model proposed by E.F. Codd (IBM) in a 1970 paper (later renamed SQL for trademark reasons). It was standardized by ANSI in 1986 and has been used in countless databases ever since.
One of the most famous security incidents is the SQL injection attack. The 2011 Sony PSN (PlayStation Network) breach exposed over 100 million personal records, with estimated damages of $171 million. It remains a staple on the OWASP Top 10 list, and using prepared statements is considered the fundamental countermeasure.
"WHERE 1=1" is a handy technique for building dynamic SQL, but it's also a classic SQL injection example. The ability to log in without a password by entering ' OR '1'='1 into a login form is still used as a canonical example in security training.