clear markdown compare help best fiddles feedback
clear markdown feedback
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 3610123 fiddles created (46896 in the last week).

select a, first_value(a) over () f, nth_value(a, 1) over () n1, nth_value(a, 2) over () n2, nth_value(a, 3) over () n3, nth_value(a, 4) over () n4, last_value(a) over () l from (values row(1), row(2), row(3), row(4)) as t(a) order by a
a f n1 n2 n3 n4 l
1 1 1 2 3 4 4
2 1 1 2 3 4 4
3 1 1 2 3 4 4
4 1 1 2 3 4 4
 hidden batch(es)