Herfindahl-Hirschman Index in SQL — sum of squared shares — implemented with a window function for the per-row total. Practice the 'concentration metric' pattern: borrow a tool from antitrust economics to quantify how concentrated denials, vendors, customers, or any categorical distribution actually is. Multi-CTE shape with SUM() OVER () for the grand total inline.