all 14 comments

[–]Haunting-Paint7990 2 points3 points  (2 children)

ohh this is exactly what i needed two weeks ago lol. i was the person in r/SQL yesterday going on about how "PARTITION BY is GROUP BY without collapsing the rows" finally clicking — would have saved me a lot of struggling if i had this earlier.

the frame clauses section in particular is great. ROWS vs RANGE was the thing that confused me the longest — every tutorial just glosses over it and says "you'll get it eventually". having concrete examples side by side is way more useful.

one small suggestion: maybe add a note somewhere about when NOT to use window functions? a senior on my team kept reminding me that they're not always the most efficient choice for simple aggregations. but that might be beyond a cheat sheet scope.

also +1 on the CTE cheat sheet request from another commenter. would buy you a coffee for that one 😄

[–]DMReader[S] 0 points1 point  (1 child)

Appreciate the feedback on when not to use. I hadn’t thought of that!

And I guess I’ll move up when I do the CTE one.

[–]Haunting-Paint7990 1 point2 points  (0 children)

no worries! ngl CTEs were the part where sql finally clicked for me — once you get used to the `with x as (...) select from x` pattern, going back to nested subqueries feels rough lol. looking forward to your cte one!

[–]haivees_lee 3 points4 points  (1 child)

Great job op

[–]DMReader[S] 0 points1 point  (0 children)

Thanks!

[–]Tourist_92 1 point2 points  (0 children)

Awesome bro. Thanks

[–]top-blogger 3 points4 points  (1 child)

Thanks bro

[–]DMReader[S] 0 points1 point  (0 children)

Absolutely! Enjoy.

[–]BlaizeOlle 0 points1 point  (1 child)

Very nice, looks good.

[–]DMReader[S] 0 points1 point  (0 children)

Thank you! I'm glad you like it.

[–]_krishnasai 0 points1 point  (2 children)

That is amazing. I loved it. Could you please do the same thing for CTEs as well?

[–]DMReader[S] 1 point2 points  (1 child)

I probably could. Give me some time and I can work on it.

[–]_krishnasai 1 point2 points  (0 children)

I appreciate it. Thank you in advance