The Horatian Archive
Home
SQL Formatter
beautify and syntax-highlight SQL queries
SELECT
JOIN
INSERT
Subquery
CREATE
CTE
Input SQL
SELECT u.id, u.name, u.email, COUNT(o.id) as order_count, SUM(o.total) as total_spent FROM users u LEFT JOIN orders o ON u.id = o.user_id WHERE u.created_at >= '2024-01-01' AND u.status = 'active' GROUP BY u.id, u.name, u.email HAVING COUNT(o.id) > 5 ORDER BY total_spent DESC LIMIT 20;
Uppercase keywords
Indent size
Format
Minify
Copy
Formatted Output (click to copy)