100% found this document useful (1 vote)
407 views2 pages

Assignment: (Include Your Name and Today's Date Above.)

The document recommends connecting Phoenix, Arizona (PHX) and Los Angeles, California (LAX) airports with a high-speed rail tunnel. This pair has the largest annual passenger capacity of over 12 million between them, with around 8,600 flights and an average flight distance of 370 miles per year in each direction. The recommendation is based on the results of a SQL query to identify airport pairs between 300-400 miles apart with over 5,000 annual flights in each direction.

Uploaded by

Uday Kiran
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
407 views2 pages

Assignment: (Include Your Name and Today's Date Above.)

The document recommends connecting Phoenix, Arizona (PHX) and Los Angeles, California (LAX) airports with a high-speed rail tunnel. This pair has the largest annual passenger capacity of over 12 million between them, with around 8,600 flights and an average flight distance of 370 miles per year in each direction. The recommendation is based on the results of a SQL query to identify airport pairs between 300-400 miles apart with over 5,000 annual flights in each direction.

Uploaded by

Uday Kiran
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Peer-Graded Assignment: Analyzing Big Data with SQL

Name: HAKAN KALAYCI


Date: 06 SEP 2019

(Include your name and today’s date above.)

Assignment
Recommend which pair of United States airports should be connected with a high-speed
passenger rail tunnel. To do this, write and run a SELECT statement to return pairs of airports
that are between 300 and 400 miles apart and that had at least 5,000 (five thousand) flights per
year on average in each direction between them. Arrange the rows to identify which one of
these pairs of airports has largest total number of seats on the planes that flew between them.
Your SELECT statement must return all the information required to fill in the table below.

Recommendation
I recommend the following tunnel route:
First Direction Second Direction
Three-letter airport code for origin PHX LAX
Three-letter airport code for destination LAX PHX
Average flight distance in miles 370 370
Average number of flights per year 8662 8662
Average annual passenger capacity 1219235 1210173
Average arrival delay in minutes 6 6

(Replace AAA and BBB with the actual airport codes, and fill in all the cells of the table.)

Method
I identified this route by running the following SELECT statement using IMPALA on the VM:

Finding Airport origin and destination code along with average number of flights per year.

SELECT
origin AS Origin,
dest AS Destination,
AVG(distance) AS avg_distance,
ROUND(COUNT(flight)/10) AS avg_annual_num_of_flights,
ROUND(SUM(seats)/10) AS avg_annual_seat_capacity,
ROUND(AVG(arr_delay)) AS avg_delay
FROM flights f
LEFT OUTER JOIN planes p
ON f.tailnum = p.tailnum
WHERE 300 <= f.distance AND f.distance <= 400

GROUP BY Origin, Destination


HAVING avg_annual_num_of_flights > 5000
ORDER BY avg_annual_seat_capacity DESC
LIMIT 10;

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy