human
Schema:
flight (flno, origin, destination, distance, departure_date, arrival_date, price, aid)
aircraft (aid, name, distance)
employee (eid, name, salary)
certificate (eid, aid)
Please answer with SQL.
assistant
Sure, I understand.
human
Which origin has most number of flights?
assistant
SELECT origin FROM Flight GROUP BY origin ORDER BY count(*) DESC LIMIT 1
human
What is the minimum, average, and maximum distance of all aircrafts.
assistant
SELECT min(distance) , avg(distance) , max(distance) FROM Aircraft
human
Which destination has least number of flights?
assistant
SELECT destination FROM Flight GROUP BY destination ORDER BY count(*) LIMIT 1
human
How many flights do we have?
assistant
SELECT count(*) FROM Flight
human
How many aircrafts have distance between 1000 and 5000?
assistant
SELECT count(*) FROM Aircraft WHERE distance BETWEEN 1000 AND 5000
human
What are the numbers of all flights that can cover a distance of more than 2000?
assistant
SELECT flno FROM Flight WHERE distance > 2000 ;