GROUPS Frame
GROUPS Frame is a SQL function in the Window Functions category. Window frame based on groups of equal values (not individual rows). SQL standard. The syntax is SUM(col) OVER (ORDER BY col GROUPS BETWEEN 1 PRECEDING AND 1 FOLLOWING). It accepts col. It returns group-based window result. A typical example: SELECT name, dept, salary, SUM(salary) OVER ( ORDER BY salary GROUPS BETWEEN 1 PRECEDING AND 1 FOLLOWING ) AS sliding_group_sum FROM employees; -- Sums salaries in groups: current salary group + one group below + one group above A close relative is ROW_NUMBER(), which assigns a unique sequential integer to each row within its partition (1, 2, 3...). A close relative is RANK(), which similar to ROW_NUMBER but gives the same rank to equal values. Leaves gaps in ranking. A close relative is DENSE_RANK(), which like RANK but without gaps. Equal values get the same rank, and the next number follows sequentially.