The current SQL queries are hard to read. Since everyone seems to have their own opinion how SQL should look like, it's probably the best to use a guide that is easily referrable to contributors.
The best I could find is this one:
http://www.sqlstyle.guide/
http://www.sqlstyle.guide/#query-syntax