LAG/LEAD Functions - Teradata Database - Teradata Vantage NewSQL Engine

Teradata Vantageā„¢ NewSQL Engine Release Summary

Product
Teradata Database
Teradata Vantage NewSQL Engine
Release Number
16.20
Published
March 2019
Language
English (United States)
Last Update
2019-05-03
dita:mapPath
hqm1512077988481.ditamap
dita:ditavalPath
TD_DBS_16_20_Update1.ditaval
dita:id
B035-1098
lifecycle
previous
Product Category
Software
Teradata Vantage

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 Vantageā„¢ SQL Functions, Expressions, and Predicates, B035-1145.