Windows II — frames & running
Exercise · SQL & Querying

Predict, then run it

Predict the output

v(d, x) = (1,10),(2,20),(3,30). Each row vs the average of its neighbours only — EXCLUDE CURRENT ROW:

SELECT d, AVG(x) OVER (ORDER BY d ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING EXCLUDE CURRENT ROW) AS peer_avg FROM v ORDER BY d;

Predict the exact output.