lead
and
lag
BigQuery
Db2 (LUW)
DuckDB
H2
MariaDB
MySQL
Oracle DB
PostgreSQL
SQL Server
SQLite
2007
2009
2011
2013
2015
2017
2019
2021
2023
⚠ 3.25.0 - 3.51.0
b
⊘ 3.5.7 - 3.23.1
✓ 2022 - 2025
b
⚠ 2012 - 2019
a
b
⚠ 8.4 - 18
b
⊘ 8.3
✓ 19c - 23.26.0
⚠ 11gR1
a
b
⚠ 8.0.11 - 9.5.0
a
e
⊘ 5.0 - 5.7
⚠ 10.2 - 12.1.2
b
d
⊘ 5.1 - 10.1
✓ 1.4.198 - 2.4.240
a
⊘ 1.4.191 - 1.4.197
⚠ 1.0.0 - 1.4.0
f
⚠ 9.7 - 12.1.2
a
c
⚠ 2.0
a
⚠ 2.0
d
⚠ 2.0
a
b
d
No negative offsets
No
respect|ignore nulls
Proprietary nulls treatment:
lead(<expr>, 'IGNORE NULLS')
(it’s a string argument)
No default possible (3rd argument)
No
ignore nulls
Proprietary nulls treatment:
lead(<expr> IGNORE NULLS)
(no comma)