create table t1 (
pk int primary key,
a int,
b int,
c char(10),
d decimal(10, 3),
e real
);
insert into t1 values
( 1, 0, 1, 'one', 0.1, 0.001),
( 2, 0, 2, 'two', 0.2, 0.002),
( 3, 0, 3, 'three', 0.3, 0.003),
( 4, 1, 2, 'three', 0.4, 0.004),
( 5, 1, 1, 'two', 0.5, 0.005),
( 6, 1, 1, 'one', 0.6, 0.006),
( 7, 2, NULL, 'n_one', 0.5, 0.007),
( 8, 2, 1, 'n_two', NULL, 0.008),
( 9, 2, 2, NULL, 0.7, 0.009),
(10, 2, 0, 'n_four', 0.8, 0.010),
(11, 2, 10, NULL, 0.9, NULL);
select pk,
nth_value(pk, 1) over (order by pk),
nth_value(pk, 2) over (order by pk),
nth_value(pk, 0) over (order by pk),
nth_value(pk, -1) over (order by pk),
nth_value(pk, -2) over (order by pk)
from t1
order by pk asc;
pk nth_value(pk, 1) over (order by pk) nth_value(pk, 2) over (order by pk) nth_value(pk, 0) over (order by pk) nth_value(pk, -1) over (order by pk) nth_value(pk, -2) over (order by pk) 11 NULL NULL NULL NULL 212 NULL NULL NULL 312 NULL NULL NULL 412 NULL NULL NULL 512 NULL NULL NULL 612 NULL NULL NULL 712 NULL NULL NULL 812 NULL NULL NULL 912 NULL NULL NULL 1012 NULL NULL NULL 1112 NULL NULL NULL
select pk,
nth_value(pk, pk) over (order by pk),
nth_value(pk / 0.1, pk) over (order by pk)
from t1
order by pk asc;
pk nth_value(pk, pk) over (order by pk) nth_value(pk / 0.1, pk) over (order by pk) 1110.0000 2220.0000 3330.0000 4440.0000 5550.0000 6660.0000 7770.0000 8880.0000 9990.0000 1010100.0000 1111110.0000
select pk,
a,
nth_value(pk, pk) over (partition by a order by pk),
nth_value(pk, a + 1) over (partition by a order by pk)
from t1
order by pk asc;
pk a nth_value(pk, pk) over (partition by a order by pk) nth_value(pk, a + 1) over (partition by a order by pk) 1011 2021 3031 41 NULL NULL 51 NULL 5 61 NULL 5 72 NULL NULL 82 NULL NULL 92 NULL 9 102 NULL 9 112 NULL 9
select pk,
a,
nth_value(pk, 1) over (partition by a order by pk ROWS between 1 preceding and1 following) as nth
from t1;
pk a nth 101 201 302 414 514 615 727 827 928 1029 11210
select pk,
a,
nth_value(a, 1) over (order by a RANGE BETWEEN 1 preceding and1 following) as nth1,
nth_value(a, 2) over (order by a RANGE BETWEEN 1 preceding and1 following) as nth2,
nth_value(a, 3) over (order by a RANGE BETWEEN 1 preceding and1 following) as nth3,
nth_value(a, 4) over (order by a RANGE BETWEEN 1 preceding and1 following) as nth4,
nth_value(a, 5) over (order by a RANGE BETWEEN 1 preceding and1 following) as nth5,
nth_value(a, 6) over (order by a RANGE BETWEEN 1 preceding and1 following) as nth6,
nth_value(a, 7) over (order by a RANGE BETWEEN 1 preceding and1 following) as nth7,
nth_value(a, 8) over (order by a RANGE BETWEEN 1 preceding and1 following) as nth8,
nth_value(a, 9) over (order by a RANGE BETWEEN 1 preceding and1 following) as nth9,
nth_value(a, 10) over (order by a RANGE BETWEEN 1 preceding and1 following) as nth10,
nth_value(a, 11) over (order by a RANGE BETWEEN 1 preceding and1 following) as nth11,
nth_value(a, 12) over (order by a RANGE BETWEEN 1 preceding and1 following) as nth12
from t1
order by pk asc;
pk a nth1 nth2 nth3 nth4 nth5 nth6 nth7 nth8 nth9 nth10 nth11 nth12 10000111 NULL NULL NULL NULL NULL NULL 20000111 NULL NULL NULL NULL NULL NULL 30000111 NULL NULL NULL NULL NULL NULL 4100011122222 NULL 5100011122222 NULL 6100011122222 NULL 7211122222 NULL NULL NULL NULL 8211122222 NULL NULL NULL NULL 9211122222 NULL NULL NULL NULL 10211122222 NULL NULL NULL NULL 11211122222 NULL NULL NULL NULL
drop table t1;
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.9 Sekunden
(vorverarbeitet am 2026-10-08)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.