SQL Formatter

Format and highlight SQL queries. Supports MySQL, PostgreSQL, SQLite, and SQL Server dialects.

SQL Input

281 chars · 2 tables
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.active = TRUE
GROUP BY u.id,
  u.name,
  u.email
HAVING COUNT(o.id) > 0
ORDER BY total_spent DESC
LIMIT 50

Runs entirely in your browser. Your files never leave your device.