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 origin and destination for flights with price higher than 300.
assistant
SELECT origin , destination FROM Flight WHERE price > 300
human
Show all destinations and the number of flights to each destination.
assistant
SELECT destination , count(*) FROM Flight GROUP BY destination
human
Show all origins and the number of flights from each origin.
assistant
SELECT origin , count(*) FROM Flight GROUP BY origin
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 place has the most flights coming from there?
assistant
SELECT origin FROM Flight GROUP BY origin ORDER BY COUNT( * ) DESC LIMIT 1 ;