Skip to content
Theory · Window functions · lesson 5 of 12

LAG and LEAD

Vera comes to the coffee shop often, and the marketer wants to know how many days pass between her orders. For that, each row has to be compared with the previous one. Aggregates won't help here: they don't care what order the rows come in.

In this lesson

  • The previous and the next row
  • Month-over-month change
  • Common mistake
  • Key points