Q1. Show the total number of flights. SELECT count(*) F
Added on -2019-09-23
| 6 pages
| 319 words
| 295 views
Trusted by 2+ million users, 1000+ happy students everyday
Showing pages 1 to 3 of 6 pages
Q1. Show the total number of flightsSELECT count(*) FROM FLIGHTS WHERE dep_time is not null;Q2. Show the total number of flights by airline (carrier)SELECT CARRIER, COUNT(*) TOTAL_FLIGHTS FROM FLIGHTS WHERE CARRIER IN(SELECT CARRIER FROM AIRLINES) GROUP BY CARRIER;
Q3. Show all of the airlines, ordered by number of flights in descending orderSELECT CARRIER, COUNT(*) TOTAL_FLIGHTS FROM FLIGHTS WHERE CARRIER IN(SELECT CARRIER FROM AIRLINES) GROUP BY CARRIER ORDER BY TOTAL_FLIGHTS DESC;Q4. Show only the top 5 airlines, by number of flights, ordered by number of flights in descending orderSELECT CARRIER, COUNT(*) TOTAL_FLIGHTS FROM FLIGHTSWHERE CARRIER IN(SELECT CARRIER FROM AIRLINES)GROUP BY CARRIERORDER BY TOTAL_FLIGHTS DESC LIMIT 5;
Q5. Show only the top 5 airlines, by number of flights of distance 1,000 miles or greater, ordered by number offlights in descending orderSELECT CARRIER, COUNT(*) TOTAL_FLIGHTS, DISTANCE FROM FLIGHTSWHERE CARRIER IN(SELECT CARRIER FROM AIRLINES) AND DISTANCE >= 1000GROUP BY CARRIERORDER BY TOTAL_FLIGHTS DESC LIMIT 5;
Found this document preview useful?
You are reading a preview Upload your documents to download or Become a Desklib member to get accesss