The following SQL query complexity measure is very simple to use, yet very powerful.
Query complexity =
number of tables +
number of SELECT/INSERT/UPDATE/MERGE columns +
number of JOINs +
number of WHERE clause predicates +
number of GROUP BY columns +
number of ORDER BY columns +
number of WHEN clauses in CASE expressions +
number of sytem function references +
number of UDF references +
number of function nestings +
number of UNIONs
Related articles:
Measuring the complexity of SQL statements
Query and Stored Procedure Optimization
