RienSQL
TASK #236 · Hard · eDreams ODIGEO

Repeat Customers

Your brief
A repeat eDreams ODIGEO customer is one with at least two confirmed bookings (status = 'confirmed') in bookings. Cancelled bookings do not count.

Write a query that for each repeat customer returns full_name, the date of the first confirmed booking first_booking, the date of the second one second_booking, and the number of days between them days_between. Sort the result by days_between ascending and, in case of a tie, by full_name.
Expected columnsfull_name first_booking second_booking days_betweeneDreams ODIGEO
SQL editor
SQLite
Ctrl / ⌘ + ↵
Result

Write a query and run it to see the results.

Schema
customerscustomer_id, full_name, country, signup_date
sessionssession_id, customer_id, market, ab_variant, device, session_date
funnel_eventsevent_id, session_id, step, event_time
bookingsbooking_id, session_id, customer_id, market, booking_date, origin, destination, total_amount, status