About the “Cumulative Route Leg Transit & Total Duration” SQL Problem
Business Scenario
Regional freight dispatchers monitor multi-stop delivery routes to ensure drivers do not exceed mandatory regulatory driving shift limits of 480 minutes (8 hours).
Expected Output & Criteria
Summary of stops, total driving time, and shift violation status per route.
Database Table Schema (PostgreSQL DDL)
PostgreSQL 16 WASMThis challenge executes directly against the following relational schema in your browser:
CREATE TABLE route_stops (
stop_id INT PRIMARY KEY,
route_id INT NOT NULL,
stop_sequence INT NOT NULL,
leg_minutes INT NOT NULL
);Target SQL Clauses & Operators
WITHGROUP BYSUM
Want more CTEs practice?
Explore the full syllabus of 12 exercises, syntax guides, and interview pitfalls.