SQL (SQLite engine)

Validate an aggregate report total

Medium70 pts~25 min
  • Aggregates
  • Report validation
  • Reconciliation
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-validate-an-aggregate-report-total

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

Objective

The finance dashboard shows 2025 revenue from non-cancelled orders; verify the header total equals the sum of the underlying order lines.

Your task

  1. 1Compute header_total: ROUND(SUM(total), 2) of orders with status <> 'cancelled' and order_date in 2025.
  2. 2Compute line_total: ROUND(SUM(quantity * unit_price), 2) of order_items for the same orders.
  3. 3Return both as one row: header_total, line_total.

Acceptance criteria

  • The last result set is one row with two equal 2025 revenue totals

Constraints

  • Only the last result set of your script is compared, so finish with the verification query.

SQL (SQLite engine) · Database Testing · Joins, views & aggregation