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 flights do we have?
assistant
SELECT count(*) FROM Flight
human
Show all origins and the number of flights from each origin.
assistant
SELECT origin , count(*) FROM Flight GROUP BY origin
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 average price for flights from Los Angeles to Honolulu.
assistant
SELECT avg(price) FROM Flight WHERE origin = 'Los Angeles' AND destination = 'Honolulu'
human
Show me the departure date and arrival date for all flights from Los Angeles to Honolulu.
assistant
SELECT departure_date , arrival_date FROM Flight WHERE origin = 'Los Angeles' AND destination = 'Honolulu'
human
What are the origins of all flights that are headed to Honolulu?
assistant
SELECT origin FROM Flight WHERE destination = "Honolulu" ;