-3

I've been trying to get my head round some very tricky SQL queries in MySQL (can range from nested queries, correlated sub queries, group concatenation, temporary tables and self joins). These are often very large and very complicated.

Recently I've been thinking of ways to try and improve the way I do this. Sometimes I try to think how a single record would be included in a dataset and follow how the keys bring together tables. Other times I think of the entire join table and mentally strip away rows according to the WHERE constraints.

Is it worthwhile looking at relational algebra to understand what is going on?

In summary, what strategies do you use for analysing large, complicated SQL queries?

LeDoc
  • 935
  • 2
  • 12
  • 24
  • Maybe I'm just dumb, but I tend to think that tricky queries are bad queries. FWIW, I almost never use correlated subqueries and group concatenation. I don't really know what a temporary table is. – Strawberry Jun 26 '15 at 16:30

1 Answers1

2

For me, it was just experience. The more I had to interact with such large, complicated codes and the more questions I asked from professors, friends, coworkers, the better I came at being able to understand everything that is going on in a code.

Joe Laert
  • 136
  • 1
  • 1
  • 7