The lead () is the next record in the current order, and the relative lag () is the previous row of records in the current order
Syntax structure: lead (value_expr [, Offset][,default]) over ([Query_partition_clause] ORDER by Order_by_clause) parameter description: value_expr A value expression, usually a field or an expression. The value_expr itself does not support parsing functions, which means that the lead does not support multiple calls. Offset offsets, should be very familiar with the mathematical concept, or is a relative offset, the table to open the current row of the offset line, if offset is an integer is indicated by the order of the first nth row, if the negative number is the nth row. If you do not provide this parameter, it is default to 1.default default value, if not found, should return what value meaning, somewhat similar to NVL (Col,value). If it is not set and cannot be found, then the return nullover is understood to be within the scope of a result set, and if the subsequent partition by is empty, then it is within the scope of the current result set. The Query_partition_clause partition statement, the statement that partitions the result collection, is optional, if not all of a partition. Order_by_clause Sort statement must be required, shape as order by xxx Desc/asc exp:select a.*, Lag (name,1) over (order by id desc) lags from T MP A
Oracle lead (), Lag ()