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
How many aircrafts have distance between 1000 and 5000?
assistant
SELECT count(*) FROM Aircraft WHERE distance BETWEEN 1000 AND 5000
human
Show the name of aircrafts with top three lowest distances.
assistant
SELECT name FROM Aircraft ORDER BY distance LIMIT 3
human
Which origin has most number of flights?
assistant
SELECT origin FROM Flight GROUP BY origin ORDER BY count(*) DESC LIMIT 1
human
How many flights do we have?
assistant
SELECT count(*) FROM Flight
human
Which destination has least number of flights?
assistant
SELECT destination FROM Flight GROUP BY destination ORDER BY count(*) LIMIT 1
human
What are the numbers of the shortest flights?
assistant
SELECT flno FROM Flight ORDER BY distance ASC LIMIT 3 ;