Toolvist

Formateador y embellecedor SQL

Formatea y embellece consultas SQL online: indenta y ordena consultas desordenadas de MySQL, PostgreSQL y SQL Server. Formateador SQL gratuito.

Formateador y embellecedor SQL gratuito

Convierte una consulta SQL de una sola línea y comprimida en SQL limpio e indentado de forma coherente. Este formateador rompe las consultas en las cláusulas principales (SELECT, FROM, WHERE, JOIN, GROUP BY y más) y las alinea para facilitar la lectura.

Query work continues with the SQL to CSV Converter, and the tables it returns can be reshaped with the CSV to JSON Converter. To translate the same statement between dialects, the SQL to CSV Converter is the tool.

Cómo usar Formateador SQL

  1. 1 Paste your SQL statement or script.
  2. 2 Choose the keyword casing — uppercase is the convention.
  3. 3 Format. Clauses move onto their own lines and nested subqueries gain indentation.
  4. 4 Check the output for any statement the parser did not recognise.

Cómo usarlo

Pega tu SQL y haz clic en Formatear consulta. Elige el tamaño de sangría y si las palabras clave deben ir en mayúsculas o minúsculas. Selecciona Minificar para colapsar la consulta de vuelta a una sola línea.

  • Rompe consultas en SELECT, FROM, WHERE, JOIN, GROUP BY, ORDER BY, etc.
  • Normalización de palabras clave en mayúsculas/minúsculas
  • Sangría ajustable (2, 4 o tab)
  • Modo Minificar para condensar una consulta a una línea

Qué maneja el formateador

El formateador entiende la estructura SQL estándar, separa listas de columnas separadas por comas, indenta condiciones JOIN y sub-cláusulas, y normaliza un amplio conjunto de palabras clave comunes (SELECT, INSERT, UPDATE, DELETE, CREATE, JOIN, ON, AND, OR y muchas más). Las cadenas literales y los comentarios se preservan tal cual.

Preguntas frecuentes

Why does formatting SQL matter when the database does not care?

Because people care. A long query written on one line is effectively unreadable, and unreadable queries are where performance problems hide — a missing join condition or a correlated subquery inside a loop is invisible in a wall of text and obvious once the structure is laid out.

Which modern features does the formatter need to handle?

Window functions with their `OVER` clauses, common table expressions declared with `WITH`, lateral joins, and the various dialect-specific constructs for JSON and arrays. These are the places where a naive formatter mangles the statement, so check the output on anything using them.

Should I format my queries in application code?

Prefer keeping the query readable in the source and letting the database parse it. Whitespace has no cost at execution time, and a readable query in version control means the next diff shows the actual change rather than a single rewritten line.

Herramientas para desarrolladores relacionadas

Ver todo en Herramientas para desarrolladores →

También te puede interesar

Herramientas de otras categorías que suelen combinarse con Formateador SQL:

Explorar el directorio completo →