r/learnSQL • • 11d ago

Understanding SQL patterns that cover 90% of interview questions

[removed]

53 Upvotes

2 comments sorted by

View all comments

4

u/Discordbothost 11d ago

The 7-day average has a gotcha if the shop has no sales on Sundays. Seven rows can span more than seven days. If quiet days count as zero, I'd fill in the missing dates first and then apply the window to one row per date.