django-planet
Aug. 4, 2020

Understanding Common Table Expressions in SQL

published by Henryk Plötz
in blog Tinker, Tamper, Alter, Fry
original entry Understanding Common Table Expressions in SQL

One of the lesser known features of modern SQL are so-called “Common Table Expressions” (CTE) or “WITH queries”. I’ll explain the mental model that helped me make sense of them, and how to use them to execute recursive queries. Afterwards I’ll show how to apply these techniques in Django.Syntactically a CTE consists of one or […]