Open lesson

Mission: the missing hour

Command palette

This mission workspace keeps code and notes in this browser tab. Export them before closing it. Running code is practice, not an automatic grade for the mission.

Brief

Select and order useful table rows while treating missing times as unknown, never as zero or an invented hour.

In the story, Voss shows only two NOCTIS-01 passages and claims the car was at South when the crash happened. Mara notices P4, a South row without a time. Imani gives you fictional rows: P1 Noctis North 21:10, P2 Test-02 South 21:20, P3 Noctis South 21:25, P4 Noctis South NULL, P5 Test-03 North 21:40, P6 Noctis South 21:35. You have a few fictional minutes to prepare a checkable answer.

Your mission

  1. Write a filter retaining Noctis rows at North or South, with clear parentheses.
  2. Write a query showing the first two Noctis rows with known times, then name their IDs.
  3. Write a query finding rows without times and name the matching row.
  4. Explain why P4 must neither be placed at 00:00 nor removed from the investigation.

How to check your work

  • The filter connects Noctis to (gate = 'North' OR gate = 'South').
  • Ascending order and LIMIT 2 give P1 then P3 among known times.
  • time IS NULL finds P4.
  • P4 stays as a row to verify; its time position remains unknown.

Course example

SELECT id, vehicle, gate, time
FROM passages
WHERE vehicle = 'NOCTIS-01' AND time IS NOT NULL
ORDER BY time ASC, id ASC
LIMIT 2;

SELECT id, vehicle, gate
FROM passages
WHERE time IS NULL;

SQLite schema and synthetic input

CREATE TABLE passages (id TEXT PRIMARY KEY, vehicle TEXT, gate TEXT, time TEXT);
INSERT INTO passages VALUES ('P1', 'NOCTIS-01', 'North', '21:10'), ('P2', 'TEST-02', 'South', '21:20'), ('P3', 'NOCTIS-01', 'South', '21:25'), ('P4', 'NOCTIS-01', 'South', NULL), ('P5', 'TEST-03', 'North', '21:40'), ('P6', 'NOCTIS-01', 'South', '21:35');

Code

Use Tab to leave the editor. Ctrl+Enter runs the source. The lines beginning with -- are task reminders. SQL ignores them. Write your query beneath them.

SQL console

Loading laboratory…

Explore Python or SQL here; this is not an operating-system shell.

This is a disposable browser experiment. The code run here is not recorded as a completed mission.

Each command starts a fresh disposable worker: it runs a captured copy of your current source, then your command with the lesson fixtures. Changes are discarded afterward. Commands never save source or award XP. Ctrl+Enter executes the command.

Virtual workspace files

Source and declarative assets are readable here without JavaScript. Python input files are created at runtime; SQL setup initializes the disposable database.

source.sql

Current editor source. Inspection shows your current edits.

-- Write a filter retaining Noctis rows at North or South, with clear parentheses.
-- Write a query showing the first two Noctis rows with known times, then name their IDs.
-- Write a query finding rows without times and name the matching row.
-- Explain why P4 must neither be placed at 00:00 nor removed from the investigation.

exemple.sql

Declarative lesson asset; this is not a file created in the Python filesystem.

SELECT id, vehicle, gate, time
FROM passages
WHERE vehicle = 'NOCTIS-01' AND time IS NOT NULL
ORDER BY time ASC, id ASC
LIMIT 2;

SELECT id, vehicle, gate
FROM passages
WHERE time IS NULL;
donnees.sql

Declarative lesson asset; this is not a file created in the Python filesystem.

CREATE TABLE passages (id TEXT PRIMARY KEY, vehicle TEXT, gate TEXT, time TEXT);
INSERT INTO passages VALUES ('P1', 'NOCTIS-01', 'North', '21:10'), ('P2', 'TEST-02', 'South', '21:20'), ('P3', 'NOCTIS-01', 'South', '21:25'), ('P4', 'NOCTIS-01', 'South', NULL), ('P5', 'TEST-03', 'North', '21:40'), ('P6', 'NOCTIS-01', 'South', '21:35');