Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help me the below questions. I was trying to do it, but I got stuck. Please give an explanation/comment as well on what you

Please help me the below questions. I was trying to do it, but I got stuck. Please give an explanation/comment as well on what you did. Thank you.

Below is the screenshots of the tables and columns:

image text in transcribed

FROM Airlines Table

image text in transcribed

FROM Airports Table

image text in transcribed

FROM Flights Table

image text in transcribed

FROM Planes Table

image text in transcribed

1. List the number of flights flown by each *kind* of aircraft. List the manufacturer, the model, and the number of flights. Label the number of flights as FlightCount. Sort on FlightCount from most flights to fewest.

3. List the location of arrival (city name and airport code in a single column, with the airport code in parentheses to the right of the city name) and number of flights each city has already received, sorted by most flights to fewest, for all airports that have received more than 30 flights as of the moment you run your query.

4. Write a query to list each Flight ID, its airport code of origin, destination, start and end dates and times, and then three columns showing the number of seats occupied (rounded up to the nearest whole seat) when the plane is 60% full, 75% full, and 95% full. Alias these three columns appropriately.

5. List the airport code of origin and airport code of destination, the departure and arrival dates and times, the airline name, and the kind of plane (manufacturer and model together in a single column) for all flights that will occur in the month of March. This query should be written so that whenever it is run, it will *always* return only those flights which will occur in March, regardless of year. If any part of a flight occurs in March, it must be included. This means that is a flight takes off before midnight on February 28, and lands at its destination early on March 1, it will still be included. The same would go for flights that depart late on the last day of March but arrive in the early morning of April 1. Sort your results so that the flights that will occur at the end of March will be at the top, and the flights at the beginning will be at the bottom.

Database Diagrams Tables System Tables FileTables dbo.Airlines dbo.Airports dbo.Flights dbo.planes 17Script for nd from SSMS 2 ESELECT TOP (1000) [AirlineID irlineName 4 FROM bol.[Airlines] 100 % Results Messages AirlineID AirlineName American Delta Southwest Airlines United Virgin Atlantic Frontier Airlines Frontier Airlines Frontier Airlines Script tor SelectTopNRows command from SSMS 2 SELECT TOP (1000) [AirportCode] , [AirportLocation] , [YearOpened] , [NumTerminals] 4 FROM [dbo]. [Airports] 100 % Results Messages AirportCode AirportLocation 1ATL 2 BOI 3 DFVW 4 IAH 5 JAX 6 JFK 7 LAS 8 LAX 9 MCO 10 MIA 11 ORD 12 PHL Atlanta, GA Boise, ID Dallas-Fort Worth, TX Houston, TX Jacksonville, FL New York, New York Las Vegas, NV Los Angeles, CA Orlando, FlL Miami, FL Chicago, IL Philadelphia, PA Pittsburgh, PA Seattle, WA San Francisco, CA Salt Lake City, UT YearOpened NumTeminals 1926 1936 1973 1957 1968 1943 1947 1928 1942 1945 1942 1927 1946 1944 1927 1933 10 12 10 4 13 PIT 4 14 SEA 15 SFO 16 SLC 1 ***Script for SelectTopNRows command from SSMS 2 ESELECT TOP (1000) [FlightID] , [PlaneID] [AirlineID] ,[AirportCodeOfDeparture] ,[AirportCodeofArrival] , [DepartureDateTime] ,[ArrivalDateTime] 9FROM [dbo]. [Flights] 100 % Messages FlightID PlanelD AirinelD AirportCodeOf Departure ArportCodeOf Amival DepartureDate Time Arival Date Time 11000 118 2 1001 111 3 1002 122 4 1003 112 5 1004 114 PIT LAS MIA ORD PHL MIA ! DFW 2018-12-23 06:28:00.000 2018-12-23 09:45:00.000 2019-04-24 18:50:00.000 2019-04-24 22:23:00.000 2018-12-29 17:46:00.000 2018-12-29 18:59:00.000 2018-12-31 16:21:00.000 2018-12-31 19:33:00.000 2019-02-23 11:53:00.000 2019-02-23 12:25:00.000 2019-01-01 11:43:00.000 2019-01-01 15:04:00.000 2019-04-09 12:41:00.000 2019-04-09 14:25:00.000 2019-03-20 12:48:00.000 2019-03-20 15:07:00.000 2019-01-06 05:31:00.000 2019-01-06 09:56:00.000 2019-01-26 22:23:00.000 2019-01-27 01:47:00.000 2018-12-04 11:16:00.000 2018-12-04 14:45:00.000 2018-11-04 02:58:00.000 2018-11-04 03:08:00.000 2019-03-22 07:00:00.000 2019-03-22 08:23:00.000 2019-04-17 11:16:00.000 2019-04-17 15:38:00.000 2018-11-14 05:18:00.000 2018-11-14 08:43:00.000 2018-12-20 14:31:00.000 2018-12-20 17:11:00.000 2019-03-13 20:09:00.000 2019-03-13 21:20:00.000 2018-11-30 14:46:00.000 2018-11-30 18:14:00.000 2018-11-26 01:22:00.000 2018-11-26 03:54:00.000 2019-02-25 10:22:00.000 2019-02-25 11:59:00.000 2019-01-23 05:58:00.000 2019-01-23 09:26:00.000 2019-02-08 20:56:00.000 2019-02-08 23:08:00.000 2019-02-24 04:44:00.000 2019-02-24 05:08:00.000 2019-02-18 12:07:00.000 2019-02-18 16:16:00.000 BOI SEA 6 1005 2 JAX SFO PHL ORD BOI 1006 101 8 1007 125 9 1008 123 10 1009 125 11 1010 127 12 1011 116 13 1012 127 14 1013 115 15 1014 110 16 1015 123 17 1016 105 18 1017 101 19 1018 118 20 1019 112 21 1020 102 22 1021 121 23 1022 120 24 1023 120 DFW SEA ORD SFO ORD LAS SEA SEA PHL DFW LAS JAX SEA SLC BOI SFO BOI AH SLC AH LAS SFO SLC DFW 1 /***Script for SelectTopNRows command from SSMS 2SELECT TOP (1000) [Plane!DJ , [Manufacturer] ,[Mode1Num] , [OriginalPurchaseDate] ,[LastServiceDate] , [AirlineID] , [NumSeats] 4 7 FROM [dbo]. [Planes] 100 % PlanelD Manufacturer ModelNum OniginalPurchaseDate Last ServiceDate AirlinelD NumSeats 787 Dreamliner 2014-10-10 2003-03-23 1999-11-24 2002-10-02 2000-04-16 2001-10-25 2009-12-02 2005-05-14 1999-10-20 2009-05-05 1999-11-25 2012-06-12 2014-12-01 2007-11-24 2000-08-31 2011-11-11 2008-06-27 2008-11-25 2013-03-27 2000-07-15 2001-12-05 2013-02-14 2008-08-21 2001-12-02 2008-02-18 2018-08-17 2018-08-26 2018-07-31 2018-06-20 2018-07-24 2018-05-03 2018-08-26 2018-03-21 2017-12-27 2018-08-20 2018-07-03 2018-06-17 2018-02-28 2018-06-07 2018-06-08 2018-09-01 2017-12-09 2018-08-27 2017-09-23 2018-04-13 2018-07-06 2018-08-16 2018-08-20 201806-16 2018-05-08 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 737-900 RJ-45 737-900 747-400 737-900 747-400 737-900 8 107 13 112 737-900 747-400 RJ-45 RJ-45 747-400 737-900 727-200 22 121 25 124

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database 101

Authors: Guy Kawasaki

1st Edition

0938151525, 978-0938151524

More Books

Students also viewed these Databases questions