Database mind map
SQL-style queries and relational patterns.
Core idea: Shape rows in this order: filter → relate → aggregate → rank.
Mnemonic: Filter → join → group → rank · Cost: Index the query path
Shape: Filter & join
Signal: The answer needs selected rows plus related data from another key space.
Move: Filter early; choose inner or left join by whether unmatched rows must survive.
Examples: Customers Without Orders, Employees & Managers, Invalid Records
Summarize: Group & having
Signal: Many rows must collapse into one answer per key.
Move: Group by the result grain, aggregate values, then filter groups with HAVING.
Examples: Duplicate Emails, Department Counts, Daily Totals
Rank: Window functions
Signal: Rows keep their identity but need rank, neighbor, or running state.
Move: Partition, order, and compute over the frame without collapsing the source rows.
Examples: Nth Salary, Top Per Department, Running Total
Protect: Keys, indexes & transactions
Signal: Reads must stay fast and multi-step writes must preserve invariants.
Move: Enforce identity, index selective predicates, and commit dependent mutations atomically.
Examples: Delete Duplicates, Pagination Index, Inventory Transfer