About the SQL Formatter
Raw SQL queries pulled from application logs, ORM (Object-Relational Mapping) consoles, or database dump files often take the form of large, single-line strings. Such queries are generally challenging to read, parse, and reason about. At the same time, pasting such queries in foreign online services is generally a privacy nightmare, as the query contains database schema information and potentially sensitive data. The SQL Formatter addresses both these concerns: it can beautify SQL query strings, transforming them into much more readable form. It also takes privacy and local processing very seriously – there are even two security-related notes in the app’s interface reminding the user that it all happens locally.
Key Features of SQL Formatter
- Local privacy /100% secure/Your database queries are processed in the browser: this means you can trust us regarding the privacy of your data. The note about the local processing is right there in the app interface: your SQL never leaves your device.
- Keyword case toggle/ SQL formatting/Use the “Keyword case” toggle to set your preferred styling for SQL keywords. Toggle the dropdown to select how you want your queries to be indented – e.g., to have 4 spaces per indent level.
- Instant beautification/Paste the raw SQL query in the input field and click the “Format” button to instantly receive the pretty-printed version of the exact same query. There is even an option to copy the formatted query or download it as a .sql file for your convenience.
How to Use SQL Formatter
- Paste the SQL query you’d like to process into the “SQL input” field (see the “Sample” button for an example query). Pick your preferred capitalization style from the “Keyword case” dropdown. Pick your preferred indentation from the “Indent” dropdown. Click the “Format” button to see the resulting, beautified SQL query. You can copy or download the query using the buttons provided and clear the input using the “Clear” button.
SQL Formatter Examples
A query written on one line, split by clause so the conditions are easier to review. Formatting does not check the query against a database.
select id, name from users where active = 1 and city = 'Rabat' order by name limit 10
SELECT id, name FROM users WHERE active = 1 AND city = 'Rabat' ORDER BY name LIMIT 10