Well Formed SQL Statements

From database24
Jump to navigation Jump to search

General

SQL statements can be read much easier, if they are well-formatted.

Good formatting is achieved as follows:

  • align the SQL keywords to the right
  • make use of field and table aliases
  • use only one field per line
  • align operators to the right
  • align values to the left


SELECT

ORDER BY

GROUP BY

INSERT

UPDATE

DELETE

JOIN

Sub SELECT