Independent project · SQL · Relational investigation

SQL Investigation in Database Detective

A relational querying case study based on Database Detective: Minor Crimes Division, an educational game with fictional cases and data.

Objective and evidence

Each simulated case required translating narrative clues into filters, finding the relevant tables, connecting records through keys, and validating intermediate results. The reviewed save and four player logs contain completion markers for Cases 1–7 and 101 distinct query strings. Culprit names are omitted because the project is about the analytical method.

SQL demonstrated

No evidence of CTEs, subqueries or window functions was found, so those techniques are not claimed.

Example 1 Comparing order value and tips

The query history shows a five-step analytical path: aggregate item prices by order, aggregate tips by order, join the intermediate results, calculate a ratio, and correct the calculation direction after reviewing the output.

SELECT
    d1.order_number,
    d2.total_tipped / d1.total_harga AS percentage_tips
FROM result_1 AS d1
JOIN result_2 AS d2
    ON d1.order_number = d2.order_number
ORDER BY percentage_tips DESC;

This demonstrates iteration and validation, rather than presenting only a final answer.

Example 2 Connecting evidence across sources

Another case combined textual clues, donation totals, membership records, rental information and driver data. The work used two LIKE conditions, aggregation by account, a HAVING threshold, and later joins to membership and location evidence.

SELECT
    payup_account,
    SUM(amount) AS total_donation
FROM payup_cashboys
WHERE note LIKE '%member%'
   OR note LIKE '%donation%'
GROUP BY payup_account
HAVING SUM(amount) > 75;
SELECT *
FROM patriots AS d1
JOIN drivers AS d2
    ON d1.first_name = d2.first_name
JOIN result_2 AS d3
    ON d2.neighborhood = d3.neighborhood;

Validation and limitations

Completion is supported by the game's own success markers for Cases 1–7. The current save records five general hints and zero query hints; this is context, not a performance claim. Logs preserve unsuccessful and corrected queries, which provide useful evidence of debugging. Because the game uses a custom parser, the project demonstrates core relational reasoning but does not establish production database experience or advanced SQL proficiency.