Skip to content

Feature #2058 - Window Function: frame exclude clause#9041

Merged
asfernandes merged 2 commits into
masterfrom
work/window-frame-exclude
Jun 2, 2026
Merged

Feature #2058 - Window Function: frame exclude clause#9041
asfernandes merged 2 commits into
masterfrom
work/window-frame-exclude

Conversation

@asfernandes
Copy link
Copy Markdown
Member

No description provided.

@asfernandes asfernandes self-assigned this May 30, 2026
@sim1984
Copy link
Copy Markdown
Contributor

sim1984 commented May 30, 2026

This is a topic for another PR, but I would like to point out that to fully complete the window theme, it is necessary to add frames with GROUPS units.

<window frame> ::=
  {RANGE | ROWS | GROUPS} <window frame extent> [<window frame exclusion>]
select hire_date
    -- include current & three previous rows
  , count(*) over ( order by hire_date rows 3 preceding ) prev3_rows
    -- include all rows between hire_date - 3 and hire_date for the current row
  , count(*) over ( order by hire_date range 3 preceding ) prev3_days
    -- include all rows with the any of the previous three and current hire_dates
  , count(*) over ( order by hire_date groups 3 preceding ) prev3_values
from   hr.employees
where  hire_date >= date'2015-03-03'
fetch first 5 rows only;
HIRE_DATE   PREV3_ROWS PREV3_DAYS PREV3_VALUES
----------- ---------- ---------- ------------
03-MAR-2015          1          1            1
10-MAR-2015          2          2            3
10-MAR-2015          3          2            3
11-MAR-2015          4          3            4
19-MAR-2015          4          1            5

@asfernandes asfernandes force-pushed the work/window-frame-exclude branch from 6c84e39 to 81ef329 Compare June 1, 2026 11:44
@asfernandes asfernandes merged commit dfd3153 into master Jun 2, 2026
45 of 46 checks passed
@asfernandes asfernandes deleted the work/window-frame-exclude branch June 2, 2026 01:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants