Available in versions: Dev (3.19) | Latest (3.18) | 3.17 | 3.16 | 3.15 | 3.14 | 3.13 | 3.12 | 3.11 | 3.10 | 3.9
Applies to ✅ Open Source Edition ✅ Express Edition ✅ Professional Edition ✅ Enterprise Edition
While poorly supported by most dialects, this standard SQL extension to the window frame clause can be quite handy to govern the exclusion of the current
EXCLUDE CURRENT ROW: Only the current row is excluded from the window
EXCLUDE GROUP: The rows belonging to the current row's group are excluded from the window
EXCLUDE TIES: The rows tied with the current row are excluded from the window
EXCLUDE NO OTHERS: The default.
This example using jOOQ:
Translates to the following dialect specific expressions:
-- COCKROACHDB, EXASOL, H2, ORACLE, POSTGRES, SQLITE, TRINO, YUGABYTEDB count(*) OVER ( ORDER BY BOOK.ID ROWS 3 PRECEDING EXCLUDE CURRENT ROW ) -- ACCESS, ASE, AURORA_MYSQL, AURORA_POSTGRES, BIGQUERY, DB2, DERBY, FIREBIRD, HANA, HSQLDB, INFORMIX, MARIADB, MEMSQL, -- MYSQL, REDSHIFT, SNOWFLAKE, SQLDATAWAREHOUSE, SQLSERVER, SYBASE, TERADATA, VERTICA /* UNSUPPORTED */
(These are currently generated with jOOQ 3.19, see #10141), or translate your own on our website
Do you have any feedback about this page? We'd love to hear it!