Expert
Window Functions
Pro Challenge

Days Between Customer Orders

Calculate the number of days between each customer's consecutive orders while retaining the current and previous order dates. Return columns: customer_id, order_id, order_date, previous_order_date, days_since_previous. Order results by: customer_id, order_date.

Preparing the interactive SQL workspace...

Challenge overview

What you will practice

Calculate the number of days between each customer's consecutive orders while retaining the current and previous order dates. Return columns: customer_id, order_id, order_date, previous_order_date, days_since_previous. Order results by: customer_id, order_date.

Difficulty
Expert
SQL concept
Window Functions