About the “Driver Idle Turnaround Time Between Completed Trips” SQL Problem
Business Scenario
Fleet dispatch algorithms monitor driver idle time between trips. A long gap between the previous dropoff and the next pickup indicates driver deadheading or localized supply shortages.
Expected Output & Criteria
Trip log showing preceding dropoff timestamp per driver.
Database Table Schema (PostgreSQL DDL)
PostgreSQL 16 WASMThis challenge executes directly against the following relational schema in your browser:
CREATE TABLE driver_trip_logs (
trip_id INT PRIMARY KEY,
driver_id INT NOT NULL,
pickup_time TIMESTAMP NOT NULL,
dropoff_time TIMESTAMP NOT NULL
);Target SQL Clauses & Operators
LAGOVERPARTITION BY
Want more Window Functions practice?
Explore the full syllabus of 14 exercises, syntax guides, and interview pitfalls.