The Brief
Wow, I can't believe we're on Day 3 already! In case you forgot, it's still John at Maven Analytics here.
You've got CTEs down. Today is the big one: window functions.
If there's a single SQL concept that separates junior analysts from senior ones, this is it. Not because window functions are rare, they show up in almost every analyst dashboard, almost every performance report, almost every interview at the mid-to-senior level. But because most people learn SQL without ever encountering them, so they arrive at complex analytical questions and reach for GROUP BY when the right tool is something else entirely.
The one-sentence explanation
GROUP BY collapses rows into groups and returns one row per group. Window functions calculate across a set of rows, but keep every row. That's the difference.
Example: if you want the total revenue per category, GROUP BY gives you one row per category. If you want the total revenue per category shown alongside every individual order, a window function does that, each order row gets the category total as an additional column.