SQL Coding

All SQL queries should be properly aligned and spaced for better readability. Sub-queries should be properly indented and separated by parenthesis. In joins and sub-queries involving multiple tables, alias names such as a, b, c, d should be used to discern the various tables and associated columns. When utilizing multiple tables in a SQL statement, the tables in the FROM clause should be prefixed with a comma (excluding the first table) so that tables can be easily added, removed or commented out from the query.

Example:

SELECT nam_first, nam_last, nam_dept, nam_mngr

FROM t_indiv a

,t_dept b

,t_mngr c

WHERE a.cde_dept = b.cde_dept

AND b.id_mngr = c.id_mngr