SQLQuokka
Start practicing
QuestionsLearnSandboxFeaturesRoadmapFAQ

Last Passenger to Board

Unsolved

Passengers board a shuttle one at a time in turn order. The shuttle can carry at most 1000 kg in total, and boarding stops at the first person who would push the total over the limit, even if someone later in line is lighter. Turn numbers are unique, and person_id does not follow turn order. Write an SQL query that returns person_name of the last person who boards.

SQL Query Editor (Ctrl+Enter to run)
0 characters · Valid
Canonical Solution Official

Official Solution is Hidden

Try solving the question with the schema explorer and hints first. When ready, reveal the verified canonical query and step-by-step logic breakdown.

Community Q&A & Discussion

Ask questions, share alternate queries, and explore solutions

0 comments
Asked By:
Classic pattern · not tied to a specific company

Submission History

Your recent query executions and answer checks

Execution Pipeline:
FROM queue
Full source dataset
6 rows total
Ready. Type a query to see live execution.
Clause: Auto-Sync · AlaSQL Engine