SQL Formatter

Format, beautify, and syntax-highlight SQL queries. All dialects. Client-side — nothing leaves your browser.

Load example query
Input 0 chars
Formatted Output 0 lines

      
SQL Quick Reference

Select & Filter

SELECT col FROM t WHERE x = 1

DISTINCT, LIMIT/TOP, OFFSET, BETWEEN, IN, LIKE, IS NULL

Joins

FROM a INNER JOIN b ON a.id = b.a_id

INNER, LEFT, RIGHT, FULL OUTER, CROSS, SELF join

Aggregation

SELECT dept, COUNT(*) GROUP BY dept HAVING COUNT(*) > 5

COUNT, SUM, AVG, MIN, MAX, GROUP BY, HAVING

Window Functions

ROW_NUMBER() OVER (PARTITION BY x ORDER BY y)

ROW_NUMBER, RANK, DENSE_RANK, LAG, LEAD, NTILE

CTEs

WITH cte AS (SELECT ...) SELECT * FROM cte

Common Table Expressions — readable subqueries

Data Modification

INSERT INTO t (col) VALUES (v); UPDATE t SET col = v WHERE ...

INSERT, UPDATE, DELETE, MERGE, UPSERT

DDL

CREATE TABLE t (id INT PRIMARY KEY, name VARCHAR(100))

CREATE, ALTER, DROP, TRUNCATE, indexes, constraints

String Functions

CONCAT, SUBSTRING, TRIM, UPPER, LOWER, REPLACE, LENGTH

Dialect-specific: || (PG/SQLite), + (TSQL), CONCAT (MySQL)

Unlock Premium Agent Features

Join the waiting list for QADIR OS — our sovereign agentic operating system that writes, optimizes, and explains your SQL automatically.