title: Best tool for assisting writing complex SQL-queries?
body: <p>I often find myself spending a lot of time figuring out why certain SUM()-aggregates sum up wrongly in SQL-queries. This problem often occurs if I do not take care when adding a JOIN, resulting in duplicate values being summed up etc. If I work with a big query with lots of JOINs, nested subqueries, GROUP BYs etc. things get very complicated to debug. </p>
  
  <p>I would like to know if there exist a tool that will make it easier to construct and debug complicated queries, by graphically illustrating the data being summed up, joined together etc.</p>
  
  <p>An example of what I'm looking for is illustrated in <a href="http://www.imada.sdu.dk/~sorenh07/misc/datacentric-querytool.png" rel="nofollow noreferrer">http://www.imada.sdu.dk/~sorenh07/misc/datacentric-querytool.png</a></p>
  
  <p>It is of course just an early mockup, and I am interested in any comment related to this.</p>