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
Show the flight number of flights with three lowest distances.
assistant
SELECT flno FROM Flight ORDER BY distance ASC LIMIT 3
human
Show all flight number from Los Angeles.
assistant
SELECT flno FROM Flight WHERE origin = 'Los Angeles'
human
Which destination has least number of flights?
assistant
SELECT destination FROM Flight GROUP BY destination ORDER BY count(*) LIMIT 1
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 aircrafts do we have?
assistant
SELECT count(*) FROM Aircraft
human
How many flights do we have?
assistant
SELECT COUNT( * ) FROM Flight ;