For the complete documentation index, see llms.txt. This page is also available as Markdown.

Windowing

Windowing is used to smooth out random variations.

It can be used to calculate moving averages.

select date, sum(value) over
(order by date between rows 1 preceding and 1 following)
from sales

Examples of other window specifications:

  • between rows unbounded preceding and current

  • rows unbounded preceding

  • range between 10 preceding and current row

    • all rows with values between current row value –10 to current value

  • range interval 10 day preceding

    • not including current row

Last updated