The Customers With Strictly Increasing Purchases interview question is a high-difficulty database problem. You need to find customers whose total annual spending has increased every single year since their first purchase. If a customer skips a year or their spending stays the same or decreases, they are disqualified. This Customers With Strictly Increasing Purchases coding problem requires identifying continuous trends over multiple rows of data.
Amazon uses this to test advanced SQL skills like "Gaps and Islands" detection and recursive window functions. It evaluates your ability to compare a value in the current row with a value in the previous row across a time series. It also checks if you can handle the constraint that there must be no gaps in years.
This follows the Database interview pattern of "Consecutive Trend Analysis."
Customer A:
When faced with trend problems, simplify. First, get the data into a "one row per year per customer" format. Then, apply the window functions to check the trend. Breaking it into steps makes it easier to write and debug.