SQL input
Formatted SQL
Indents and wraps a query so it can be read, keeping every comment, string and quoted identifier. The result is then checked token by token against what you pasted — if anything changed, you get the reason instead of the output. Everything runs in your browser.
DELIMITER: DELIMITER ;; is a mysql-client command, not SQL. The formatter behind this page does not know it, reads the following ; as the end of a statement, and cuts trigger and procedure bodies in half. mysqldump output is full of these, so the whole file is refused rather than half-broken. Use Minify, which keeps DELIMITER lines whole.'it\'s fine'; the formatter's Redshift lexer does not, so it loses track of where the string ends and reports an error several lines further down. This page names the real cause. Doubling the quote ('it''s fine') formats cleanly.'a' and 'b' only when a newline separates them; on one line it is a syntax error. If reflowing produced that, the result is refused.FROM or WHERE (FROM orders AS o, with its JOIN and AND lines below it), a short comma list (GROUP BY 1, 2, ORDER BY placed_at DESC, id — up to 80 columns) and single values (LIMIT 50). The column list of SELECT stays one column per line, and so does anything with a comment in it or a first item that spans several lines, such as a subquery. Expanded puts every clause body on its own lines. Either way only whitespace moves, and the check above confirms it.UPPERCASE touches only what the dialect's grammar recognises as a keyword. If an unquoted table name happens to be one (year, status) and your MySQL runs on a case-sensitive filesystem, the query will fail loudly on that table — pick Leave as typed for scripts like that.