SQL Practice Logo

SQLPractice Online

Scenario SQL Question

Find Customers Inactive for 90+ Days

Build mastery in Date Operations with this scenario-based SQL challenge and live execution support.

Problem Statement

For each customer whose most recent order is more than 30 days before the latest order in the dataset, report days_since_last_order and a customer_status of 'Churned' (>90), 'At Risk' (>30), else 'Active'. Return customer_id, customer_name, last_order_date, days_since_last_order, customer_status — ordered by days_since_last_order DESC.

Relevant Tables

customersorders

SQL Concepts Used in This Scenario

Strengthen your understanding with these targeted learning topics: