Suppose you have the
Certadv.Stock6Mon data set that contains opening and closing stock
prices for the past six months for two different companies. You are
trying to determine which company has the bigger difference in the
daily opening price between consecutive days.
To start, consider what
you want the LAG function to return, as shown below.
The LAG function enables you to compare the daily opening prices between consecutive days by retrieving the previous values of a column from the last time that ...