Connect relational data across enterprise tables. Detect dormant accounts, attribute marketing ROI across campaigns, build organizational hierarchies with self joins, and reconcile ledgers with FULL OUTER JOIN.
Key patterns and rules practiced in this track.
Keeps all rows from table_a. If no matching row exists in table_b, its columns are filled with NULL. Filtering WHERE b.id IS NULL extracts records with zero child activity.
SELECT a.* FROM table_a a LEFT JOIN table_b b ON a.id = b.a_id WHERE b.id IS NULLSELECT c.customer_id, c.name FROM customers c LEFT JOIN orders o ON c.customer_id = o.customer_id WHERE o.order_id IS NULL;
Joining a table to itself allows modeling recursive parent-child relationships like organizational charts, flight layovers, and referral chains.
SELECT e.name, m.name AS manager FROM employees e JOIN employees m ON e.manager_id = m.idSELECT emp.full_name, mgr.full_name AS manager_name FROM staff emp LEFT JOIN staff mgr ON emp.manager_id = mgr.staff_id;
Returns all records from both tables. When a key matches, rows are joined; unmatched records from either table appear with NULLs on the opposing side.
SELECT * FROM bank_statement s FULL OUTER JOIN internal_ledger l ON s.ref = l.refSELECT COALESCE(s.ref, l.ref) AS ref_code, s.amount, l.amount FROM bank_statements s FULL OUTER JOIN ledger_entries l ON s.ref = l.ref;
Click any problem to open the interactive editor.
List of customer_id, company_name, account_manager, and plan_name for customers with zero activity records.
Campaign performance metrics with campaign_name, channel, budget_spent, revenue_generated, and roas.
Roster of admitted inpatients with attending physician details, sorted by ward room.
List of unreceived purchase orders sorted chronologically by expected delivery date.
Org chart hierarchy showing employee name, title, and manager name.
Compliance violation list of high-value wires sent to unverified accounts.
Trips performed with uninspected vehicles sorted by fare amount.
Complete plan-to-feature matrix with enabled status flag.
Flagged prescriptions where prescribed drug substance matches documented patient allergies.
Reconciliation table classifying each transaction as Matched, Missing in Bank, or Missing in Ledger.
High-value abandoned cart sessions with cart value >= $100.
Two-leg transit routes from Chicago with layover hub and total flight hours.
Run queries directly in your browser against realistic tables.