subject

When people fly long distances, a direct city-to-city flight is often more expensive than taking two flights with a stop in a hub city. Travelers might save even more money by breaking the trip into three flights with two stops. But for the purposes of this challenge, let's assume that no one is willing to stop three times! You have a table with individual airport-to-airport flights, which contains the following columns.

Id - the unique ID of the flight
Origin - the origin city of the current flight
Destination - the destination city of the current flight
Cost - the cost of the current flight.

The cities are all represented by an abbreviation composed of three uppercase English letters. Your task is to write a select statement that lists all the cheapest possible trips that can be done in two or fewer stops. The outputs should have columns origin, destination, stops (indicating the number of stops in current trips) and total_cost. If two trips cost the same but have a different number of stops, include the one with the fewest stops. Sort the output by origin then by destination.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 16:00
Speed is how fast an object moves a certain distance within a length of time. how is speed calculated? a) distance/time b) time/distance c) velocity/time d) distance x time
Answers: 1
question
Computers and Technology, 23.06.2019 02:00
For a typical middle-income family, what is the estimated cost of raising a child to the age of 18? $145,500 $245,340 $304,340 $455,500
Answers: 1
question
Computers and Technology, 23.06.2019 14:30
Select the correct answer. andy received a potentially infected email that was advertising products. andy is at risk of which type of security threat? a. spoofing b. sniffing c. spamming d. phishing e. typo-squatting
Answers: 2
question
Computers and Technology, 23.06.2019 15:30
Hey so i was just trying out some game hacks so i took a paste from online and built it in my visual studio and then suddenly my computer was working or clicking on stuff on its own am i hacked?
Answers: 1
You know the right answer?
When people fly long distances, a direct city-to-city flight is often more expensive than taking two...
Questions
question
English, 06.10.2020 14:01
question
Mathematics, 06.10.2020 14:01
Questions on the website: 13722363