logo

Q1. Show the total number of flights. SELECT count(*) F

   

Added on  2019-09-23

6 Pages319 Words295 Views
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;

End of preview

Want to access all the pages? Upload your documents or become a member.

Related Documents
Structured Query Language (SQL)
|7
|1547
|119

Statistics and Data Analysis: Statistical Modelling Assignment
|8
|1527
|291

(solved) SQL Queries Assignment
|5
|372
|57

Desklib Study Material Library: ERD Relationship, SQL Queries
|7
|1319
|264

Database Systems: Solved Assignments
|4
|586
|136

Bird Strikes: Analysis and Recommendations
|16
|898
|80