RienSQL
TASK #229 · Easy · Amadeus

Busiest Routes

Your brief
The flights table stores flights within Spain with the departure airport origin and the arrival airport destination (IATA codes). A route is an (origin, destination) pair with direction: MAD → BCN and BCN → MAD are different routes.

Write a query that returns the routes with 3 or more flights in the table, cancelled ones included: origin, destination and the number of flights flights_count. Sort by flights_count in descending order and, on ties, by origin and then by destination alphabetically.
Expected columnsorigin destination flights_countAmadeus
SQL editor
SQLite
Ctrl / ⌘ + ↵
Result

Write a query and run it to see the results.

Schema
airlinesairline_code, airline_name, country
flightsflight_id, flight_number, airline_code, origin, destination, scheduled_departure, actual_departure, status
bookingsbooking_id, flight_id, booking_date, price, status