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 name and distance for all aircrafts.
assistant
SELECT name , distance FROM Aircraft
human
Show flight number for all flights with more than 2000 distance.
assistant
SELECT flno FROM Flight WHERE distance > 2000
human
Show origin and destination for flights with price higher than 300.
assistant
SELECT origin , destination FROM Flight WHERE price > 300
human
Show the flight number of flights with three lowest distances.
assistant
SELECT flno FROM Flight ORDER BY distance ASC LIMIT 3
human
Show the id and name of the aircraft with the maximum distance.
assistant
SELECT aid , name FROM Aircraft ORDER BY distance DESC LIMIT 1
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 ;