Which destination in the flights database is the furthest distance away, based on information in the flights table. Show the SQL query(s) that support your conclusion. SELECT DISTINCT flight, origin, dest, distance AS ‘furthest distance’ FROM flights WHERE distance in max distance from flights;
What are the different numbers of engines in the planes table? For each number of engines, which aircraft have the most number of seats? Show the SQL statement(s) that support your result. SELECT engines, MAX(seats) FROM planes GROUP by engines;
Show the total number of flights. SELECT COUNT(*) from flights;
Show the total number of flights by airline (carrier). SELECT carrier, count(*) FROM flights GROUP by carrier;
Show all of the airlines, ordered by number of flights in descending order. SELECT carrier, count(*) AS FlightCount FROM flights GROUP by carrier ORDER by FlightCount Desc;
Show only the top 5 airlines, by number of flights, ordered by number of flights in descending order. SELECT carrier, count(*) AS FlightCount FROM flights GROUP by carrier ORDER by FlightCount Desc limit 5;
Show only the top 5 airlines, by number of flights of distance 1,000 miles or greater, ordered by number of flights in descending order. SELECT carrier, count(*) AS FlightCount FROM flights WHERE distance >=1000 GROUP by carrier ORDER by FlightCount Desc limit 5;
Create a question that (a) uses data from the flights database, and (b) requires aggregation to answer it, and write down both the question, and the query that answers the question. * Create a query that shows top 5 airlines, by number of flights in the month of May, ordered by flights number from only descending order. SELECT carrier, count(*) AS FlightCount FROM flights WHERE month = 5 GROUP by carrier ORDER by FlightCount Desc limit 5;