Open lesson

Mission: reproduce the false trace without erasing originals

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

Add fictional rows, correct one row and remove a disposable row while keeping writes targeted and initial facts checkable.

In the story, Voss arrives with two authorizations bearing your ID. Imani keeps the original register intact and gives you only a practice copy. She wants A1 and A2 with shared event key EXIT-7, then A1’s mistyped source corrected and draft TEMP removed. Mara watches every WHERE condition.

Your mission

  1. Describe the effect of the three practice INSERT commands and why A1 and A2 may share EXIT-7.
  2. Write a command correcting A1’s gtae.csv to gate.csv only.
  3. Write a command removing TEMP only and give the two rows remaining after the final read.
  4. Explain what UPDATE or DELETE without WHERE could do and what the test cannot prove about you.

How to check your work

  • A1, A2 and TEMP are added; A1 and A2 have different IDs and event_key is not unique.
  • UPDATE authorizations SET source_file = 'gate.csv' WHERE id = 'A1'; targets A1.
  • DELETE FROM authorizations WHERE id = 'TEMP'; leaves A1 and A2 with EXIT-7.
  • Without a filter many rows might change or vanish; simulation names no real author.

Course example

PRAGMA foreign_keys = ON;
CREATE TABLE vehicles (code TEXT PRIMARY KEY);
CREATE TABLE authorizations (
    id TEXT PRIMARY KEY,
    vehicle_code TEXT NOT NULL,
    actor_id TEXT NOT NULL,
    event_key TEXT NOT NULL,
    attempt_no INTEGER NOT NULL,
    source_file TEXT,
    FOREIGN KEY (vehicle_code) REFERENCES vehicles(code)
);
INSERT INTO vehicles (code) VALUES ('NOCTIS-01');
INSERT INTO authorizations
    (id, vehicle_code, actor_id, event_key, attempt_no, source_file)
VALUES ('A1', 'NOCTIS-01', 'HERO-ID', 'EXIT-7', 1, 'gtae.csv');
INSERT INTO authorizations
    (id, vehicle_code, actor_id, event_key, attempt_no, source_file)
VALUES ('A2', 'NOCTIS-01', 'HERO-ID', 'EXIT-7', 2, 'mirror.csv');
INSERT INTO authorizations
    (id, vehicle_code, actor_id, event_key, attempt_no, source_file)
VALUES ('TEMP', 'NOCTIS-01', 'TEST', 'DRAFT', 0, 'scratch.csv');
UPDATE authorizations SET source_file = 'gate.csv' WHERE id = 'A1';
DELETE FROM authorizations WHERE id = 'TEMP';
SELECT id, event_key, source_file FROM authorizations ORDER BY id;

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.

-- Describe the effect of the three practice `INSERT` commands and why A1 and A2 may share `EXIT-7`.
-- Write a command correcting A1’s `gtae.csv` to `gate.csv` only.
-- Write a command removing TEMP only and give the two rows remaining after the final read.
-- Explain what `UPDATE` or `DELETE` without `WHERE` could do and what the test cannot prove about you.

exemple.sql

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

PRAGMA foreign_keys = ON;
CREATE TABLE vehicles (code TEXT PRIMARY KEY);
CREATE TABLE authorizations (
    id TEXT PRIMARY KEY,
    vehicle_code TEXT NOT NULL,
    actor_id TEXT NOT NULL,
    event_key TEXT NOT NULL,
    attempt_no INTEGER NOT NULL,
    source_file TEXT,
    FOREIGN KEY (vehicle_code) REFERENCES vehicles(code)
);
INSERT INTO vehicles (code) VALUES ('NOCTIS-01');
INSERT INTO authorizations
    (id, vehicle_code, actor_id, event_key, attempt_no, source_file)
VALUES ('A1', 'NOCTIS-01', 'HERO-ID', 'EXIT-7', 1, 'gtae.csv');
INSERT INTO authorizations
    (id, vehicle_code, actor_id, event_key, attempt_no, source_file)
VALUES ('A2', 'NOCTIS-01', 'HERO-ID', 'EXIT-7', 2, 'mirror.csv');
INSERT INTO authorizations
    (id, vehicle_code, actor_id, event_key, attempt_no, source_file)
VALUES ('TEMP', 'NOCTIS-01', 'TEST', 'DRAFT', 0, 'scratch.csv');
UPDATE authorizations SET source_file = 'gate.csv' WHERE id = 'A1';
DELETE FROM authorizations WHERE id = 'TEMP';
SELECT id, event_key, source_file FROM authorizations ORDER BY id;