Amazon’s Fulfillment Centers need to track "Aging Inventory" to avoid long-term storage fees and manage cash flow. Inventory that sits too long in the warehouse is a liability.
Write a query to categorize all current inventory into three age buckets based on how long it has been in the warehouse:
The "Current Date" for this problem is 2026-02-14.
| batch_id(INTEGER) | warehouse_id(INTEGER) | quantity(INTEGER) | unit_cost(DECIMAL) | arrival_date(DATE) |
|---|---|---|---|---|
| 1 | 10 | 100 | 5 | 2026-02-10 |
| 2 | 10 | 50 | 10 | 2026-01-15 |
| 3 | 10 | 20 | 25 | 2025-12-01 |
| 4 | 20 | 200 | 2 | 2026-02-01 |
| 5 | 20 | 10 | 100 | 2025-11-15 |
| 6 | 10 | 30 | 15 | 2026-01-20 |
| warehouse_id(INTEGER) | warehouse_name(VARCHAR) |
|---|---|
| 10 | SEA-1 |
| 20 | NYC-5 |
| product_id(INTEGER) | product_name(VARCHAR) |
|---|---|
| 101 | Kindle |
| warehouse_id(INTEGER) | age_bucket(VARCHAR) | total_value(DECIMAL) |
|---|---|---|
| 10 | 0-30 | 1450 |
| 10 | 60+ | 500 |
| 20 | 0-30 | 400 |
| 20 | 60+ | 1000 |