This advanced SQL exercise is part of the book: Advanced SQL – Practical Techniques and Use-Cases, which includes 100 day-to-day SQL challenges (and solutions), need-to-know advanced features, and key concepts.

Given the following flight timetable. The table specifies 3 flights (flight_id) that departure Ben Gurion International Airport. For each of these flights, the destinations (flight_dest) are indicated by their order. For example, the first connection of flight no. 1 is in Bucharest, then Rome, and the final destination is Warsaw.

In addition, this table displays the status (arrival_desc) of each flight. For example, flight no. 2 has already passed Zurich and Madrid and is now on its way to Boston, flight no. 3 left Munich, passed through Frankfurt, and arrived at its final destination in Budapest.

(flight_id int,
flight_dest int,
flight_dest_name varchar(25),
arrival_desc varchar(25))

Would you like to read more?