Instruction
Excellent! That's all we wanted to teach you today. Let's review what we've learned:
LEAD(x)andLAG(x)give you the next/previous value in the column x, respectively.LEAD(x, y)andLAG(x, y)give you the value in the column x of the row which is y rows after/before the current row, respectively.LEAD(x, y, z)andLAG(x, y, z)give you the value in the column x of the row which is y rows after/before the current row, respectively. If there are no rows (i.e. near the ending/beginning of the table) the function returns z instead ofNULL.FIRST_VALUE(x)andLAST_VALUE(x)give you the first and last value in the column x, respectively.LAST_VALUE()usually requires the window frame to be set toROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING
Now, are you ready for a short quiz?
Exercise
Click to start.



