My issue
help me to solve this problem
My code
/* Write a query to do the following
- We need to output the following - 'connection_id', 'origin', 'destination', 'cost_category'.
- 'cost_category' is the alias for the column which stores the values 'High cost', 'Medium cost', 'Low cost'
- Cost of operating a truck is the alias - running_cost = distance x cost_per_distance.
- **Hint** you will need to JOIN the tables 'Network' and 'Truck' and then apply relevant conditions
- **Hint** you will need to use CASE / WHEN to identify the 'cost_category' */
SELECT
connection_id,
origin,
destination,
CASE
WHEN distance * cost_per_distance > 800 THEN 'High cost'
WHEN distance * cost_per_distance > 600 THEN 'Medium cost'
ELSE 'Low cost'
END AS cost_category
FROM
Network
JOIN
Truck ON Network.truck_id = Truck.truck_id
WHERE
Truck.truck_type = 'Trailer';
Learning course: Learn Data Analytics using SQL and Python
Problem Link: Practice Problem in - CodeChef