Rainbow Deals - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
FIRST_VALUE(), LAST_VALUE()
Summary
23. Summary

## Instruction

Excellent! That's all we wanted to teach you today. Let's review what we've learned:

• LEAD(x) and LAG(x) give you the next/previous value in the column x, respectively.
• LEAD(x, y) and LAG(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) and LAG(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 of NULL.
• FIRST_VALUE(x) and LAST_VALUE(x) give you the first and last value in the column x, respectively.
• LAST_VALUE() usually requires the window frame to be set to
ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING

Now, are you ready for a short quiz?

Click to start.