Skip to content
ParticleDB
Release candidateParticleDB 1.1.19-rc.17 is not yet GA or ready for production data.Release status →

Window functions

Calculate per-row results across an ordered group.

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 rank
FROM docs_window ORDER BY id;

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.

SQL reference · Application guide · Troubleshooting