Skip to content
SDETRole
SDETRole

Find orphan order items

intermediate Joins Challenge 6 of 13

A product delete feature shipped last sprint, and you suspect it leaves order lines pointing at products that no longer exist.

Requirements

  • Return the id, order_id and product_id of every order item whose product does not exist in products.
  • The query must keep working as products are deleted or restored.

Expected output

id | order_id | product_id 11 | 2038 | 11 18 | 2042 | 14

Checks (3)

  • ○Sample data
  • ○A product is deleted
  • ○The missing products are restored

Each check builds a fresh database and compares your result with the reference solution's: same number of columns in the same order (names are not checked), and the same rows in any order.

query.sqlExecutes on SQLite in your browser

Ctrl/⌘ + Enter to check query · your code is saved in this browser

Results

Use Run query to see your rows, then Check query to grade it.

Schema · Acme Store

SQLite

Loading the database…

“null” marks columns that allow NULL. Foreign keys are not enforced, as in many real test databases.

Type to search across SDETRole.

Full-text search by Pagefind · runs in your browser Open search page →