SQL (SQLite engine)

Test a transaction commits fully

Medium70 pts~25 min
  • Transactions
  • Atomic commit
Practice app · Acme Commerce DB

A real SQL database (SQLite engine) seeded with an e-commerce and HR dataset, with schema browser and query runner.

Test URL
/lab/database-testing-test-a-transaction-commits-fully

Your starter code already declares TEST_URL — never hardcode a host.

Objective

Place a paid order as one transaction (order, line, payment, stock decrement) and verify every part was committed.

Your task

  1. 1BEGIN a transaction.
  2. 2Insert an order for customer 7: order_date '2025-12-30', status 'paid', total 179 (it gets id 61).
  3. 3Insert its line (product 2 × 2 at 89.5) and a payment (amount 179, method 'card', paid_at '2025-12-30').
  4. 4Decrement product 2's stock by 2, then COMMIT.
  5. 5Verify all four writes are visible together.

Acceptance criteria

  • Order, line, payment and stock change are all committed
  • The script uses BEGIN … COMMIT

Constraints

  • Every run starts from a freshly seeded database, so your script must include its own setup statements.

SQL (SQLite engine) · Database Testing · Transactions & concurrency