The LAG function provides access to a row at a given offset prior to the current position, and the LEAD function provides access to a row at a given offset after the current position.
Example: How to
Retrieve the quantity sold from the previous month ?
SELECT CALENDAR_MONTH_DESC,
SUM(quantity_sold),
lag(SUM(quantity_sold),1) OVER (ORDER BY CALENDAR_MONTH_DESC) "Previous Month"
FROM
sales,
TIMES
WHERE
times.TIME_ID = sales.TIME_ID AND
times.CALENDAR_YEAR = '2019'
GROUP BY CALENDAR_MONTH_DESC
ORDER BY CALENDAR_MONTH_DESC ASC