Rank the race finalists
Before you start this beginner track
Tables, rows, and columns. Start with SELECT before grouped queries.
Guided code reading and debugging. Runnable coding challenges are available in JavaScript, Python, and SQL.
Understand it, then try it.
A race report must show the two fastest runners and resolve tied times consistently. ORDER BY can compare multiple columns: it uses the second only when the first is tied. ASC puts smaller times first and names in ascending text order. LIMIT then keeps the first two rows of that ordered result.
WITH laps(runner, seconds) AS ( VALUES ('Mina', 54), ('Otis', 49), ('Luz', 49), ('Bea', 61))SELECT runner, secondsFROM lapsORDER BY seconds ASC, runner ASCLIMIT 2;Run each query independently in SQLite 3. VALUES inside a common table expression supplies all data, so no tables or database setup are needed. Quiz outputs show data rows only, with | between columns and no headers.
Track the values line by line. Predict the result before running this example in your own editor.