DevDesk

DEVDESK / GUIDE

SQL Formatter — Usage guide

Break SQL clauses onto readable lines. The formatter does not execute queries or connect to a database.

How to use it

  1. Paste SQL or load an example.
  2. Choose Generic, MySQL, PostgreSQL, or Oracle formatting.
  3. Set indentation, format the text, and review it before copying.

Input and output examples

Example 1

Input

SELECT id,name FROM users WHERE active=1 ORDER BY name;

Output

SELECT
  id,
  name
FROM users
WHERE active = 1
ORDER BY name;

Example 2

Input

WITH recent AS (SELECT id FROM events WHERE created_at > CURRENT_DATE) SELECT id FROM recent;

Output

WITH recent AS (
  SELECT id
  FROM events
  WHERE created_at > CURRENT_DATE
)
SELECT id
FROM recent;

Frequently asked questions

Does this validate SQL?

No. It formats text only; it neither runs SQL nor verifies database-specific syntax.

Can I format MariaDB and Oracle SQL?

Choose the MySQL dialect for MySQL-family syntax and PL/SQL for Oracle. Coverage follows the formatter library.

Are comments and string literals preserved?

The formatter tokenizes comments and literals. Review important query sections before using the formatted result.