human
Schema:
routes (rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare)
airports (apid, name, city, country, x, y, elevation, iata, icao)
airlines (alid, name, iata, icao, callsign, country, active)
Please answer with SQL.
assistant
Sure, I understand.
human
Provide the names of all airlines.
assistant
SELECT name FROM airlines;
human
Find the number of routes provided by each airline. Show airline name.
assistant
SELECT COUNT( * ) , T1.name FROM airlines AS T1 JOIN routes AS T2 ON T1.alid = T2.alid GROUP BY T1.name;
human
which airline operates the most routes?
assistant
SELECT T1.name FROM airlines AS T1 JOIN routes AS T2 ON T1.alid = T2.alid GROUP BY T2.alid ORDER BY COUNT( * ) DESC LIMIT 1 ;