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
Which destination has least number of flights?
assistant
SELECT destination FROM Flight GROUP BY destination ORDER BY count(*) LIMIT 1
human
Show flight number for all flights with more than 2000 distance.
assistant
SELECT flno FROM Flight WHERE distance > 2000
human
Show name and distance for all aircrafts.
assistant
SELECT name , distance FROM Aircraft
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 the name of aircrafts with top three lowest distances.
assistant
SELECT name FROM Aircraft ORDER BY distance LIMIT 3
human
Show the flight number of flights with three lowest distances.
assistant
SELECT flno FROM Flight ORDER BY distance ASC LIMIT 3 ;