SQL FormatterFormat your SQLPaste your SQL: SELECT u.id, u.name, CASE WHEN EXISTS ( SELECT 1 FROM orders o WHERE o.user_id = u.id AND o.status = 'open' ) THEN 'Has Open Orders' ELSE 'No Open Orders' END AS order_status, ( SELECT COUNT(*) FROM sessions s WHERE s.user_id = u.id AND s.active = true ) AS active_sessions FROM users u WHERE u.created_at > '2025-01-01' ORDER BY u.name; SQL Dialect: Standard SQL PostgreSQL MySQL SQLite Format Copy Enable Live Preview Keyword Case: Uppercase Lowercase Indentation: 2 spaces 4 spaces Tab Lines Between Queries: 1 2 3 Columns per line: Inline One per line First Column Placement: Inline Newline Enable CASE Layout Keyword Case Column Layout Indent Line Breaks Spacing CASE Layout