Flights With Exactly One Stop
Medium
Self & Cross Joins
Given direct flights, list every itinerary origin -> via -> destination made of exactly two flights where the first lands where the second departs. Order by origin, via, destination.
Table schema
Flights(id INT PRIMARY KEY, origin VARCHAR(5), dest VARCHAR(5))Sample data
id | origin | dest
1 | DEL | BOM
2 | BOM | GOA
3 | DEL | GOA
4 | GOA | BLR
Discussion
No discussions yet.
Shalyam Support
Hi! Ask us anything — we'll reply on WhatsApp or Telegram within 24 hours.