Skip to main content
Sign in with Google (Free) to save your verified Meridian Bank checkpoints & earn your 500-point capstone badge.
Sign In with Google
SQL Detective Capstone • £170M Accounting Drift

Global DynaDatum Bank £170M Forensic Investigation

Run real SQL queries on each checkpoint below to uncover the 6 root-cause data bugs behind the £170M accounting variance. Each verified query recovers part of the missing balance until the ledger reaches £0.00 drift.

Practice DDL Lab 01
Active Accounting Discrepancy
£170,000,000.00
Verified: £0 (0/6 SQL checkpoints passed)
£170M Drift£0.00 Target

Interactive SQL Forensic Checkpoints (0/6 Verified)

CHECKPOINT 1 • ENTITY RESOLUTION£45M

Customer Deduplication (CRM vs. Core Banking)

Customers exist under dual identities across CRM and Core Banking, causing duplicate balance sums.

Your Detective Mission: Find the matching customer pairs where lower(trim(c.full_name)) = lower(trim(m.full_name)) AND c.dob = m.dob. Return c.crm_id, m.cob_id, and m.full_name ordered by c.crm_id.
bronze.crm_customers (crm_id, full_name, dob)silver.cob_customers (cob_id, full_name, dob)
checkpoint_1.sql
CHECKPOINT 2 • FINANCIAL PRECISION£21M

Multi-Currency FX Rate Conversion Drift

EUR and USD balances were added directly to GBP without converting using end-of-month spot FX rates.

Your Detective Mission: Join silver.core_balances b to silver.fx_rates fx on b.currency = fx.currency AND b.balance_date = fx.rate_date. Return b.account_id, ROUND(b.ledger_balance * fx.to_gbp_rate, 2) AS gbp_balance ordered by b.account_id.
silver.core_balances (account_id, balance_date, ledger_balance, currency)silver.fx_rates (currency, rate_date, to_gbp_rate)
checkpoint_2.sql
CHECKPOINT 3 • SCD TYPE 2£8M

Bi-Temporal Product Catalog (£8M Cash ISA Fix)

Cash ISA accounts were double-counted because the product catalog join omitted the valid-time date window.

Your Detective Mission: Join silver.core_balances b to silver.product_catalog p on b.product_code = p.product_code AND b.balance_date BETWEEN p.effective_from AND p.effective_to. Return b.account_id, p.category_l1, b.ledger_balance.
silver.core_balances (account_id, product_code, balance_date, ledger_balance)silver.product_catalog (product_code, category_l1, effective_from, effective_to)
checkpoint_3.sql
CHECKPOINT 4 • LATE-ARRIVING DATA£38M

Delayed Card Payment Interchange Settlement

A 14-hour delayed interchange batch arrived after the 5:00 PM ledger cutoff, leaving unsettled batches unflagged.

Your Detective Mission: Query bronze.payment_interchange to find all batches where settlement_delay_hours > 4. Return batch_id, settlement_delay_hours, and amount_gbp ordered by batch_id.
bronze.payment_interchange (batch_id, settlement_delay_hours, amount_gbp)
checkpoint_4.sql
CHECKPOINT 5 • SECURITY GOVERNANCE£15M

Audit Unclassified Credit Application PII

Credit applications exposed passport numbers in non-Restricted tiers due to missing security classifications.

Your Detective Mission: Query gov.credit_classification to find columns where security_tier IS NULL OR security_tier NOT IN ('Public', 'Internal', 'Restricted'). Return column_name and security_tier ordered by column_name.
gov.credit_classification (column_name, security_tier)
checkpoint_5.sql
CHECKPOINT 6 • MEDALLION RECONCILIATION£43M

Verify Conformed Silver Balance Totals

Verify final deposit totals per currency on 2026-09-30 without duplicate account snapshots.

Your Detective Mission: Query silver.core_balances for balance_date = '2026-09-30' and return currency, COUNT(DISTINCT account_id) AS total_accounts, and ROUND(SUM(ledger_balance), 2) AS total_deposits grouped by currency and ordered by currency.
silver.core_balances (account_id, balance_date, ledger_balance, currency)
checkpoint_6.sql