Hidden-city ticketing is a travel hack where a passenger books a flight from City A to City C with a layover in City B because it is cheaper than a direct flight from A to B. The passenger then exits at the layover city, skipping the final leg.
Write a query to identify these passengers. A Hidden-City flyer is defined as:
- A user who has a confirmed booking for a multi-leg journey (e.g., Leg 1: A to B, Leg 2: B to C).
- The flight_logs show that the passenger successfully completed all legs except the very last one.
- The flight_logs show no record of the passenger flying the final leg of that booking.
Rules:
- Both legs must belong to the same booking_id.
- Leg 2 must start from the destination of Leg 1.
- Output columns: user_id, booking_id, skipped_destination.
- skipped_destination is the final city of the booked itinerary that was not flown.
- Result must be sorted by booking_id ascending.