Amazon Business wants a customer churn list for an account review. Using April 1, 2025 as the reporting date, write a PostgreSQL query to identify customers who have not placed an order during the previous 90 days.
Requirements
- Return each customer's ID, name, and most recent order date on or before April 1, 2025.
- Include customers with no orders, representing their latest order date as
NULL.
- Treat the 90-day lookback boundary, January 1, 2025, as active. Customers with an order on or after that date are not churned.
- Exclude orders dated after the reporting date and sort the result by customer ID.