Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
The very basics
Infinite looping
Processing graphs with recursive CTE
Summary
35. Exercise 3

Instruction

Very well done! The last problem deals with graphs.

Exercise

We want to travel between four cities presented in the table destination starting from Warsaw. We have another table called ticket which lists all possible flying connections for us. Your task is to find the path which will be cheapest in terms of the total tickets cost. List all paths starting in Warsaw which go through all four cities. Order the paths by descending total_cost.

In your answer, provide the following columns:

  • path – city names separated by '->',
  • last_id – ID of the last city,
  • total_cost – total cost of tickets,
  • count_places – the number of places visited, should equal 4.