Ant-DAO-MentSliding Windows
Updated 2025-03-11
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
›
⌄
with raw_data as (
select '2023-01-01'::timestamp as block_timestamp, 5 as price
union select '2023-01-02'::timestamp as block_timestamp, 10 as price
union select '2023-01-03'::timestamp as block_timestamp, 15 as price
union select '2023-01-04'::timestamp as block_timestamp, 20 as price
union select '2023-01-05'::timestamp as block_timestamp, 25 as price
union select '2023-01-06'::timestamp as block_timestamp, 20 as price
union select '2023-01-07'::timestamp as block_timestamp, 20 as price
union select '2023-01-08'::timestamp as block_timestamp, 20 as price
union select '2023-01-09'::timestamp as block_timestamp, 20 as price
union select '2023-01-10'::timestamp as block_timestamp, 5 as price
)
select
*,
avg(price) over (order by block_timestamp asc rows between 1 PRECEDING and 1 FOLLOWING )
from raw_data
QueryRunArchived: QueryRun has been archived