SQL (SQLite engine)

Test a backup completes

Medium70 pts~25 min
  • Backups
  • Completeness checks
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-backup-completes

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

Objective

Back up the order tables into an attached backup database and verify the backup is complete, table by table.

Your task

  1. 1ATTACH DATABASE ':memory:' AS backup.
  2. 2Copy orders, order_items and payments with CREATE TABLE backup.<name> AS SELECT * FROM main.<name>.
  3. 3Verify with one row per table: table name, live row count, backup row count (orders, order_items, payments).

Acceptance criteria

  • backup.orders, backup.order_items and backup.payments match the live tables
  • The last result set shows equal live and backup counts for all three tables

Constraints

  • Every run starts from a freshly seeded database, so your script must include its own setup statements.
  • An attached ':memory:' database stands in for the backup file; it lives for the rest of the session.
  • Only the last result set of your script is compared, so finish with the verification query.

SQL (SQLite engine) · Database Testing · Performance, backup & recovery