LAG and LEAD
Accessing Adjacent Rows
LAG and LEAD let you reference a previous or next row's value without a self-join.
SELECT order_date, revenue,
LAG(revenue) OVER (ORDER BY order_date) AS prev_revenue,
LEAD(revenue) OVER (ORDER BY order_date) AS next_revenue
FROM daily_sales;