Skip to content
SDETRole
SDETRole

Clean up feature-branch test data

intermediate DELETE Challenge 10 of 13

The test-results database is filling up with runs from short-lived feature branches. Remove them, keeping everything from main and other branches.

Requirements

  • Delete every build whose branch starts with feature/, and every test run that belongs to one of those builds.
  • Keep all other builds and their runs, including branches that merely contain the word “feature”.
  • Leave no test runs pointing at a build that no longer exists.
  • After your SQL runs, the check query shown below is compared with the expected state.

Expected output

build_id | branch | runs 101 | main | 10 103 | main | 11 105 | main | 11 NULL | (runs with no build) | 0

Checks (3)

  • ○Sample data
  • ○Hotfix and feature builds side by side
  • ○A release branch with 'feature' in its name

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. Your SQL changes data, so the comparison runs SELECT b.id AS build_id, b.branch, COUNT(tr.id) AS runs FROM builds b LEFT JOIN test_runs tr ON tr.build_id = b.id GROUP BY b.id UNION ALL SELECT NULL, '(runs with no build)', COUNT(*) FROM test_runs WHERE build_id NOT IN (SELECT id FROM builds); afterwards.

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 · QA Tracker

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 →