16.10 - LAG/LEAD Functions - Teradata Database

Teradata Database Release Summary

prodname
Teradata Database
vrm_release
16.10
created_date
June 2017
category
Release Notes
featnum
B035-1098-161K

The LAG and LEAD functions add to the ordered analytic capabilities provided by Teradata Database. The LAG function accesses data from a row preceding the current row at a specified offset value in a window group, while the LEAD function returns data from a row following the current row at a specified offset value in a window group.

The functions improve compatibility, and are used with Teradata Database for OLAP and decision support queries. The functions support both Teradata syntax and ANSI syntax to improve data migration.

Benefits

  • Provides compatibility with and simplifies data migration from other databases.
  • Increases Teradata Database compatibility to the SQL Standard.

Considerations

The LEAD function returns the value displayed in a following row, while the LAG function gives the value from a previous row.

Additional Information

For more information on the LAG/LEAD functions, see Teradata® Database SQL Functions, Operators, Expressions, and Predicates, B035-1145.