Author: Alexey Makhotkin squadette@gmail.com, ~5400 words. This is the first public revision of this text. Early readers have shared encouraging feedback, but I’m sure there’s still room for improvement. I’m releasing it now to gather broader input from a wider audience. Problem Many times I’ve seen people asking for help with fixing some complicated SQL queries. A common scenario is that people try to solve the problem by using JOIN with multiple tables, sometimes with subqueries.