SQL code layout and beautification
There is a good article on this here : https://www.simple-talk.com/sql/t-sql-programming/sql-code-layout-and-beautification/
The problem :
Badly-formatted SQL is the bane of my life. That is because my life is spent staring at SQL Code. Other peoples SQL code often looks ridiculous to me. As there is no common standard for laying out TSQL, even for SQL Server, we all have strongly-held opinions on how to lay out code. I've yet to find two database developers who agree in detail on how it should be done. I've seen entire projects written in lower case, with Javadocs headers, others done entirely in upper case with hardly any line-breaks.
The reason that every database developer has such strongly held views is that he gets used to a particular format. I find that I can read SQL code that is laid out to my taste far faster than SQL code written inconsistently or to one of the wilder fringe-formats. Actually, it is worse than that, going back to look at old code that I've written can be a painful experience if the old code is written to a style that I've since discarded.
The worst experience a database developer can suffer is to be obliged to support a SQL application that has been written by someone else. It is difficult to look a programmer in the eye after you've had to maintain his SQL code. A SQL Code Beautifier is the only way to stay sane and keep friendships.
...
More interesting articles can be found on the site :
https://www.simple-talk.com/sql