human
Schema:
airport (id, City, Country, IATA, ICAO, name)
operate_company (id, name, Type, Principal_activities, Incorporated_in, Group_Equity_Shareholding)
flight (id, Vehicle_Flight_number, Date, Pilot, Velocity, Altitude, airport_id, company_id)
Please answer with SQL.
assistant
Sure, I understand.
human
Which of the airport names contains the word 'international'?
assistant
SELECT name FROM airport WHERE name LIKE '%international%'
human
What are the names and types of the companies that have ever operated a flight?
assistant
SELECT T1.name , T1.type FROM operate_company AS T1 JOIN flight AS t2 ON T1.id = T2.company_id
human
which pilot is in charge of the most number of flights?
assistant
SELECT pilot FROM flight GROUP BY pilot ORDER BY count(*) DESC LIMIT 1
human
What is the id, name and IATA code of the airport that had most number of flights?
assistant
SELECT T1.id , T1.name , T1.IATA FROM airport AS T1 JOIN flight AS T2 ON T1.id = T2.airport_id GROUP BY T2.id ORDER BY count(*) DESC LIMIT 1
human
What are the ids and names of the companies that operated more than one flight?
assistant
SELECT T1.id , T1.name FROM operate_company AS T1 JOIN flight AS t2 ON T1.id = T2.company_id GROUP BY T1.id HAVING count(*) > 1
human
What are the different pilot names who had piloted a flight in the country 'United States' or in the airport named 'Billund Airport'?
assistant
SELECT DISTINCT T2.pilot FROM airport AS T1 JOIN flight AS T2 ON T1.id = T2.airport_id WHERE T1.country = "United States" OR T1.name = "Billund Airport" ;