Question:
I just wanted to know if you could share some techniques on how to optimize SQL queries (for example, inner join first before performing some steps, do not use computations, etc.).
Answer:
Since this borders on a black art, the only advice I can offer is this: depending on how you are running these, use ODBC trace to trace the output of the query and, if you can, use showplan to see how the optimizer handles your request, and go from there.
There may be a zillion ways to improve performance, from creating an index to dropping one, or from changing datatypes. How about floats for auto-incrementing primary keys? (Just Kidding!)