Scenario SQL Question
Days Between Consecutive Orders per Customer
Build mastery in Date Operations with this scenario-based SQL challenge and live execution support.
Problem Statement
For each order, show the gap in days since the same customer's previous order using LAG. Return customer_id, order_id, order_date, prev_order_date, days_since_prev — ordered by customer_id, order_date, order_id.
Relevant Tables
orders
SQL Concepts Used in This Scenario
Strengthen your understanding with these targeted learning topics: