SQL Stylist

Reformat a SQL query with newlines and indentation on the major clauses. A readability pass, not a full parser.

Input
Output