T11 SQL · Lesson 6
Games: Creating, updating and deleting
Choose the right option, fill in the blanks, write small pieces of code and fix broken ones. Code runs in a safe box inside this page.
Solved 0 of 49 items in this lesson.
1 / 27
ledger.db holds halls (1 Engine Hall, 2 Clock Tower, 3 Couriers' Yard, 4 Archive) and gauges (id, name, hall_id, unit, reading): 1 boiler (1, C, 96.5), 2 pump (1, bar, 4.2), 3 fan (1, rpm, 1200.0), 4 chimney (3, C, NULL), 5 pendulum (2, s, 2.0), 6 kettle (3, C, 88.0), 7 bell (2, Hz, 440.0), 8 valve (1, bar, 4.2), 9 compass (NULL, deg, 270.0). The gauges' rules: name NOT NULL UNIQUE, unit NOT NULL DEFAULT 'C', CHECK (reading >= 0); foreign keys are not checked. What does this print?
bash
sqlite3 -list ledger.db "INSERT INTO gauges (name, hall_id, unit, reading) VALUES ('lamp', 4, 'lux', 300) RETURNING id;"