When I first learned SQL, GROUP BY felt like all I needed. Then I hit a question it couldn't answer: "Show me every trip, and next to it, that rider's total spend." GROUP BY collapses rows. I wanted to keep every row and still see an aggregate beside it. That's what window functions are for. In this post we'll use a small taxi company database (a... Weiterlesen
Intelligence View
⚡ tsecurity.de Intelligence
SQL Window Functions Explained
When I first learned SQL, GROUP BY felt like all I needed. Then I hit a question it couldn't answer: "Show me every trip, and next to it, that rider's total…