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
- Describe the effect of the three practice
INSERTcommands and why A1 and A2 may shareEXIT-7. - Write a command correcting A1’s
gtae.csvtogate.csvonly. - Write a command removing TEMP only and give the two rows remaining after the final read.
- Explain what
UPDATEorDELETEwithoutWHEREcould 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_keyis not unique. UPDATE authorizations SET source_file = 'gate.csv' WHERE id = 'A1';targets A1.DELETE FROM authorizations WHERE id = 'TEMP';leaves A1 and A2 withEXIT-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;