Galactic High Spenders by Week

Galactic High Spenders by Week :Track Weekly Top-Spending Customers with Aggregate Window Functions Advanced

Discover which customers spend the most credits each week at Xorthax’s trading post.

Xorthax wants to identify his wealthiest patrons by week. For each customer, show their total spending for each week, highlight which customers had the highest total spend during that week with a t/f, and the rank of each customer for the week. All spending figures should be based on the orderdetails table.
Write Your Query
Next Problem →

This mirrors analyzing customer spending over weekly periods to identify top spenders and monitor buying patterns.

You will practice joining tables, applying aggregate window functions, and ranking results within time-based groups.

This problem is labeled as Advanced. It’s intended for learners who are already comfortable with common window functions and want to push into more complex analytical patterns. Don’t rush — work through the hints one at a time and study the final query structure carefully.

Yes. Every problem comes with optional hints you can reveal one at a time, plus a fully worked step-by-step solution. You decide how much help you want while practicing.

All problems on PracticeWindowFunctions.com are completely free and can be solved without creating an account. Right now there are over 80 practice problems, with new ones added regularly.
SQL for Data Analysis (O’Reilly)
SQL for Data Analysis (O’Reilly)

SQL techniques tailored for analytics and reporting workflows.

(Affiliate link – as an Amazon Associate I earn from qualifying purchases.)