How to Understand Long and Complex SQL Queries STEP 1) Big Picture First! ... STEP 2) Focus on the Final Columns First! ... STEP 3) Understand the Final GROUP BY and WHERE Clauses. ... STEP 4) Look at the Final JOINs. ... STEP 5) Look at CTEs and Subqueries in Reverse Order. ... STEP 6) Time to Understand CTEs and Subqueries. More items... Feb 1, 2022