https://github.com/skytecat/thecheapestroute_sql
SQL statement that returns the cheapest tour using a Recursive Query
https://github.com/skytecat/thecheapestroute_sql
postgresql sql
Last synced: over 1 year ago
JSON representation
SQL statement that returns the cheapest tour using a Recursive Query
- Host: GitHub
- URL: https://github.com/skytecat/thecheapestroute_sql
- Owner: skytecat
- Created: 2024-08-31T11:01:29.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-09-07T06:17:35.000Z (almost 2 years ago)
- Last Synced: 2025-01-14T02:09:07.930Z (over 1 year ago)
- Topics: postgresql, sql
- Homepage:
- Size: 83 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# The cheapest route SQL
Описание на русском [тут](./README_RUS.md).

# Technical assignment
Please take a look at the Graph. There are 4 cities (a, b, c and d) and arcs between them with cost (or taxination). Actually the cost (a,b) = (b,a).
Please write one SQL statement using Recursive Query that returns all tours (aka paths) with minimal traveling cost if we will start from city "a".
You need to find the cheapest way of visiting all the cities and returning to your starting point. For example, the tour looks like that a -> b -> c -> d -> a.
Please sort data by total_cost and then by tour.
# Instructions for running the code
Please download a script with Database Model from src/database/model.sql and apply the script to your database.
Run the script from src/the_cheapest_route.sql