title: Best way to understand complex SQL statements?
body: <p>Does anyone have a method to understand complex SQL statements?  When reading structural / OO code there are usually layers of abstraction that help you break it down into manageable chunks.  Often in SQL, though, it seems that you have to keep track of what's going on in multiple parts of a query all at the same time.</p>
  
  <p>The impetus for this question is the SQL query discussed in <a href="https://stackoverflow.com/questions/378548/need-help-with-a-complex-join-statement-in-sql">this question about a complex join</a>.  After staring at the answer queries for a number of minutes I finally decided to step through the query using particular records to see what was going on.  That was the only way I could think of to understand the query piece by piece.</p>
  
  <p>Is there a better way to break a SQL query down into manageable pieces?</p>