Skip to content

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

Open
asfernandes wants to merge 2 commits into
masterfrom
work/window-frame-exclude
Open

Feature #2058 - Window Function: frame exclude clause#9041
asfernandes wants to merge 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

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