Explo SQL Formatter Tool

SQL formatting is an important step in the SQL writing process. Yet, not all text editing applications offer an ability to format SQL-specific syntax. Below is a tool to paste in your SQL, click 'Format SQL', then get your SQL formatted automatically for you!

SQL Format Rules

SQL styling has some subjectivity to it. Each SQL language (which is database-dependent) has slightly different styling preferences. That being said, SQL editing typically has some best practices that most would consider to be true. Thanks to the great aggregation work of Simon Hollywell, we are able to summarize these into a succinct set of guides, which we further summarized below. While only some of these rules are auto-enforced by this SQL format tool, it is a great general guide for table and query structure alike.

General Rules


Use consistent, descriptive names and identifiers
Utilize white space and indentation for readability
Store dates in ISO 8601 format (YYYY-MM-DD HH:MM:SS.SSSSS)
Prefer standard SQL functions for portability
Avoid redundant SQL and include necessary comments.


CamelCase, descriptive prefixes like sp_ or tbl_
Plurals in names; use collective terms instead
Quoted identifiers; prefer SQL-92 double quotes if needed
Applying object-oriented design to SQL/database structures

Naming Conventions


Ensure uniqueness, avoid reserved keywords, and limit length to 30 characters
Start with a letter, avoid ending with an underscore
Use underscores instead of spaces, avoid multiple consecutive underscores
Avoid abbreviations unless widely understood


Prefer collective names over plurals
Avoid prefixes and giving a table the same name as any of its columns


Use singular names, avoid id as the only identifier
Use lowercase except for proper nouns


Aliases should relate to the original name
Use the first letter of each word in the object’s name
Include the AS keyword for clarity

Stored Procedures

Include a verb in the name
Avoid prefixes like sp_

Uniform Suffixes

Use specific suffixes like _id, _status, _total, etc., for clarity

Query Syntax

Use uppercase for reserved words
Prefer full-length keywords over abbreviated ones
Use spacing to align code for readability
Include spaces around equals signs and after commas
Use line spacing to separate logical sections
Indent joins and subqueries for clarity

SQL Formatting Embedded Analytics Solutions

It is great to have tools in your workflow that help enforce some of these standards, while making sure it's easy to iterate. Explo is an embedded analytics solution that offers this capability out-of-the-box, as it offers a wonderful SQL editing experience, with built-in formatting and error detection and prevention. Further, Explo offers a seamless way for teams to visualize their SQL data in a drag-and-drop charting interface. Explo is the future of embedded analytics and makes SQL writing at the forefront of this next-level experience. Feel free to give Explo a try by reaching out to the team today!