Rainbow Deals - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
9. The LEAD(x, y, z) function
FIRST_VALUE(), LAST_VALUE()
Summary

## Instruction

Perfect! The last possible type of LEAD(x, y, z) takes three arguments:

SELECT
Name,
OpenDate,

The third argument (z) tells the function what it should return if no matching value is found. Previously, the last rows got NULLs from the function, because there were no "lead" (further) rows for them. Now, you can specify what should be displayed in such cases instead of the default NULL. Here, we show '2000-01-01'. Note that this value must be of the same type as the column itself: if you show dates with LEAD(), the last argument must be a date too. You can't show "not available" or 0 instead.
Modify the template based on the previous exercise so that it shows -1 instead of NULL if no LEAD() value is found.
Use a third argument in LEAD(...).