Monday, July 09, 2018

Telling The Story with CTE's

I can divide the history of my knowledge of SQL in two ages, before and after Common Table Expressions (CTE's). I shake my head in disbelief when I think of all the times I could have used CTE's and used subqueries instead. To think that many years ago I was in a conversation and I said "I don't like subqueries" but didn't know there was a better way. I was still new with SQL and I found a subquery like a hole to another dimension. But the skill of SQL seemed to be measured in the ability to manage multiple nested subqueries so I had to learn the hard way. Having the mind of a developer, I am more interested in being able to make sense of what the query is doing based on its readability.