SQL (SQLite engine)

Compare UI data against the database

Medium70 pts~25 min
  • UI vs DB comparison
  • JOIN
  • GROUP BY
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-compare-ui-data-against-the-database

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

Objective

The “My orders” page for customer 1 (Ava Thompson) lists each order newest first; write the query that produces exactly what the page must show so it can be compared field by field.

Your task

  1. 1Join orders to order_items for orders where customer_id = 1.
  2. 2Return one row per order: orders.id, order_date, status, the number of order lines (COUNT of order_items) and total.
  3. 3Sort newest first: ORDER BY order_date DESC, then id DESC as a tiebreaker.

Acceptance criteria

  • The last result set matches the expected order list, in order
  • The query joins order_items

Constraints

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

SQL (SQLite engine) · Database Testing · Data validation basics