The desk is trying a fee change that it does not want to keep. Start a transaction, make the trial update, and cancel it before inspecting the fees.
These tables are already loaded at the start of this lesson.
gearOne row represents one equipment catalog entry.
| Field / SQL type | Meaning | Rules |
|---|---|---|
gear_id · integer | Identifier of the equipment entry. | Primary key. Required; cannot be NULL. |
name · text | Equipment display name. | Required; cannot be NULL. |
category · text | Equipment grouping, such as repair, outdoors or art. | Required; cannot be NULL. |
fee · numeric(6,2) | Daily borrowing charge in currency units, stored to two decimal places. | Required; cannot be NULL. |
available · boolean | Whether the equipment is available to borrow: true or false. | Required; cannot be NULL. |
note · text | Optional handling note. | Nullable; NULL means no note is recorded. |
Only note may be missing. Category labels are sample values, not an enforced vocabulary. No currency code or nonnegative-fee constraint is declared; a fee is a daily charge, not a count of items.
The final state proves the original values are present, not that a rollback was the only way to obtain them. Use the requested transaction steps for the practice.
The setup below is already loaded before each attempt. It is reference material, not code to paste into script.sql.
CREATE TABLE gear (
gear_id integer PRIMARY KEY,
name text NOT NULL,
category text NOT NULL,
fee numeric(6,2) NOT NULL,
available boolean NOT NULL,
note text
);
INSERT INTO gear VALUES
(1, 'Hand drill', 'repair', 4.00, true, NULL),
(2, 'Tent', 'outdoors', 12.00, true, 'Dry before return'),
(3, 'Saw', 'repair', 6.00, false, 'New blade'),
(4, 'Camp stove', 'outdoors', 6.00, true, NULL),
(5, 'Brush kit', 'art', 3.00, false, 'Wash bristles');
Edit script.sql, use Run to inspect the result, then Submit.
| gear_id | fee |
|---|---|
| 1 | 4 |
| 2 | 12 |
| 3 | 6 |
| 4 | 6 |
| 5 | 3 |
Inspect the final values after the rollback, outside the transaction block.