Window functions
Calculate per-row results across an ordered group.
Example
Section titled “Example”CREATE TABLE docs_window (id BIGINT PRIMARY KEY, team TEXT, amount BIGINT);INSERT INTO docs_window VALUES (1, 'support', 10), (2, 'support', 30), (3, 'platform', 20);SELECT id, team, amount, ROW_NUMBER() OVER (PARTITION BY team ORDER BY amount DESC, id) AS rankFROM docs_window ORDER BY id;Behavior
Section titled “Behavior”A window function retains the input rows. PARTITION BY defines independent groups; ordering defines the sequence within each group. Include a tie-breaker when equal values need a stable order. SQL window functions and window Particles have separate support and frame rules.
Related
Section titled “Related”This site uses Google Analytics cookies to count visits. Privacy · License