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 flight number for all flights with more than 2000 distance.
assistant
SELECT flno FROM Flight WHERE distance > 2000
human
Show origins of all flights with destination Honolulu.
assistant
SELECT origin FROM Flight WHERE destination = 'Honolulu'
human
Which origin has most number of flights?
assistant
SELECT origin FROM Flight GROUP BY origin ORDER BY count(*) DESC LIMIT 1
human
Show all origins and the number of flights from each origin.
assistant
SELECT origin , count(*) FROM Flight GROUP BY origin
human
Show the flight number and distance of the flight with maximum price.
assistant
SELECT flno , distance FROM Flight ORDER BY price DESC LIMIT 1
human
Show origin and destination for flights with price higher than 300.
assistant
SELECT origin , destination FROM Flight WHERE price > 300 ;