Hopefully your SQL queries aren’t tangled like this. (Photo:Author)

Complex Queries in SQL

Robert de Graaf
Towards Data Science
4 min readAug 8, 2019

--

Texts on SQL are good at providing the basic templates of SQL syntax, but sometimes the queries in those books are a little idealised compared to real life, with no more than two or three tables to join and a small number of fields to deal with. As a result, the queries themselves are usually no more than a dozen lines long.

It often happens in the wild that you end up joining across many tables with long winded ‘WHERE’…

--

--