In MySQL, we can use the LEAD()
function to get the value of a subsequent row. For example we can get a value from the next row, or the one after that, and so on.
This enables us to do things like compute the difference between a value in the current row and a value in a following row. We can do this even if both values are in the same column.
Continue reading