Time to Second Purchase

medium
Unit 13 · Window Functions VI0/2 to milestone

The second purchase is a key moment: it turns a one-off buyer into a customer. For every customer, return name, second_order (the date of their second order, or NULL) and days_to_second (whole days from their first order to their second, or NULL). Order a customer's orders by order_date, then id. Sort by name.

Pro problem

Unlock this and every premium problem across all tracks — plus hidden-test grading, advanced AI engineering modules and new content every week.

Start 7-day free trial
query.sql · SQLite
Run your code to see results. ⌘↵ to run · ⌘⇧↵ to submit
Time to Second Purchase · TechGradify